Public report of GreptimeTeam/greptimedb, published 14 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 14 November 2026, 18:04 UTC · Survey ID cd_a01460d2c37f4a8ebfdac8928e1b9460

GreptimeTeam/greptimedb

Measured 14 November 2026, 17:58 UTC, at code version 176bc07

CAI score 61out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 1 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A very large codebase: 911,614 lines of product code in 71 projects, tests not counted · Estimated rebuild effort: about 7.9 person-years · Weakest lens: Code Health, 51

Findings by how serious they are

559 critical 2983 serious 334 minor

9 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 17:58 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

62of 62 dimensions measured by tools.
3726of 3876 findings point to an exact file and line, so you can open each one in the code. The other 150 concern the repository as a whole, such as missing documentation.
62dimensions across 8 lenses, read from 911,614 lines of product code in 71 projects.
Chapters

Executive summary

GreptimeTeam/greptimedb falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 61 out of 100 and is rated Adequate, and 525 of its 559 critical findings are security problems.

Code Health, at 51, is the weakest lens and counts most in the score. The best first step is turning on missing-value checks, worth about 7 points. Writing log messages as searchable templates comes next, worth about 6 points. Raising Code Health to 70 would lift the score to about 68.

366 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Fifty-three secrets can leak from the build pipeline, and forty-three settings leave the servers or containers unsafe. Pinning each tool to an exact version, limiting each secret to its own step and correcting the unsafe settings would close these risks. Passing outside input through environment variables would fix the 32 pipeline steps that put outside input straight into a shell command, and fixing the weaknesses the scanner points to would deal with the 15 security weaknesses in the code. The 29 sets of files in separate parts that keep changing together need that dependency made explicit.

The product code is 911,614 lines, about €1,200,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Code Health 51 · counts for 45%Production Readiness 63 · counts for 25%Security and Compliance 66 · counts for 14%Architecture 70 · counts for 8%Maturity 90 · counts for 4%Domain Modelling 91 · counts for 2%Performance 94 · counts for 1%Event Sourcing 100 · counts for 1%

If Code Health rose from 51 to 70, the lowest score rated Strong, the score would rise from 61 to about 68.

Code composition: what the lines of code are
Product code 86%Tests 14%
New since the last survey: 1008 findings

These 1008 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · o11ybench-storage.audit (cyclomatic 37) .github/scripts/o11ybench-storage.py
  • Cyclomatic Complexity · servers::http::prom_store::exemplar::write (cyclomatic 28) src/servers/src/http/prom_store/exemplar.rs
  • Cyclomatic Complexity · PagedCache::fetch (cyclomatic 26) src/common/cache/src/paged.rs
  • Cyclomatic Complexity · RegionWorkerLoop::handle_region_edit (cyclomatic 21) src/mito2/src/worker/handle_manifest.rs
  • Cyclomatic Complexity · WriteDispatcher::execute_tracked (cyclomatic 20) src/operator/src/write_dispatcher/progress.rs
  • Cyclomatic Complexity · mito2::sst::index::column::json_index_target (cyclomatic 19) src/mito2/src/sst/index/column.rs
  • Cyclomatic Complexity · o11ybench-storage.summary (cyclomatic 19) .github/scripts/o11ybench-storage.py
  • Cyclomatic Complexity · o11ybench-storage.main (cyclomatic 19) .github/scripts/o11ybench-storage.py
  • Cyclomatic Complexity · RegionWorkerLoop::execute_alter_request (cyclomatic 18) src/mito2/src/worker/handle_alter.rs
  • Cyclomatic Complexity · mito2::compaction::twcs::units::pick_closed_merge_candidates (cyclomatic 18) src/mito2/src/compaction/twcs/units.rs
  • Cyclomatic Complexity · pipeline::etl::processor::logfmt::parse_logfmt (cyclomatic 18) src/pipeline/src/etl/processor/logfmt.rs
  • Cyclomatic Complexity · servers::otlp::metrics::encode_histogram (cyclomatic 18) src/servers/src/otlp/metrics.rs
  • Cyclomatic Complexity · SharedRange::read (cyclomatic 17) src/mito2/src/cache/range_cache/shared_range.rs
  • Cyclomatic Complexity · RegionWorkerLoop::process_bulk_requests (cyclomatic 17) src/mito2/src/worker/handle_write.rs
  • Cyclomatic Complexity · RegionWorkerLoop::handle_requests (cyclomatic 17) src/mito2/src/worker.rs
  • Cyclomatic Complexity · pipeline::etl::processor::logfmt::parse_quoted_value (cyclomatic 17) src/pipeline/src/etl/processor/logfmt.rs
  • Cyclomatic Complexity · servers::postgres::copy_in::parse::scan_copy_from_stdin (cyclomatic 17) src/servers/src/postgres/copy_in/parse.rs
  • Cyclomatic Complexity · servers::prom_remote_write::v2::convert_remote_write_v2 (cyclomatic 17) src/servers/src/prom_remote_write/v2.rs
  • Cyclomatic Complexity · servers::prom_remote_write::v2::decode_series_leaves (cyclomatic 16) src/servers/src/prom_remote_write/v2.rs
  • Cyclomatic Complexity · SetRegionOption::try_from (cyclomatic 16) src/store-api/src/region_request.rs
  • Cyclomatic Complexity · benchmark-version-comparison.traces (cyclomatic 16) .github/scripts/benchmark-version-comparison.py
  • Cognitive Complexity · servers::http::prom_store::exemplar::write (cognitive 66) src/servers/src/http/prom_store/exemplar.rs
  • Cognitive Complexity · o11ybench-storage.audit (cognitive 64) .github/scripts/o11ybench-storage.py
  • Cognitive Complexity · PagedCache::fetch (cognitive 55) src/common/cache/src/paged.rs
  • Cognitive Complexity · o11ybench-storage.summary (cognitive 44) .github/scripts/o11ybench-storage.py
  • Cognitive Complexity · WriteDispatcher::execute_tracked (cognitive 40) src/operator/src/write_dispatcher/progress.rs
  • Cognitive Complexity · servers::prom_remote_write::v2::convert_remote_write_v2 (cognitive 37) src/servers/src/prom_remote_write/v2.rs
  • Cognitive Complexity · pipeline::etl::processor::logfmt::parse_logfmt (cognitive 34) src/pipeline/src/etl/processor/logfmt.rs
  • Cognitive Complexity · SharedRange::read (cognitive 33) src/mito2/src/cache/range_cache/shared_range.rs
  • Cognitive Complexity · AccessLayer::write_sst_inner (cognitive 31) src/mito2/src/access_layer.rs
  • Cognitive Complexity · EventPayloadResolver::parse_payload (cognitive 29) src/servers/src/http/event.rs
  • Cognitive Complexity · frontend::instance::exemplar::collect (cognitive 27) src/frontend/src/instance/exemplar.rs
  • Cognitive Complexity · Dispatch::dispatch_migrations (cognitive 26) src/meta-srv/src/procedure/drain_datanode/dispatch.rs
  • Cognitive Complexity · IndexerBuilderImpl::build (cognitive 26) src/mito2/src/sst/index.rs
  • Cognitive Complexity · Instance::metrics (cognitive 24) src/frontend/src/instance/otlp.rs
  • Cognitive Complexity · o11ybench-storage.main (cognitive 24) .github/scripts/o11ybench-storage.py
  • Cognitive Complexity · RegionWorkerLoop::handle_region_edit (cognitive 23) src/mito2/src/worker/handle_manifest.rs
  • Cognitive Complexity · WriteDispatcher::send_batch (cognitive 23) src/operator/src/write_dispatcher.rs
  • Cognitive Complexity · Instance::query_exemplars_inner (cognitive 22) src/frontend/src/instance/exemplar.rs
  • Cognitive Complexity · RegionWorkerLoop::execute_alter_request (cognitive 22) src/mito2/src/worker/handle_alter.rs
  • Cognitive Complexity · ci_scope.fetch_changed_files (cognitive 22) .github/ci/ci_scope.py
  • Cognitive Complexity · datatypes::json::validate_type_hints (cognitive 21) src/datatypes/src/json.rs
  • Cognitive Complexity · CompactionScheduler::handle_compaction_pick_finished_inner (cognitive 21) src/mito2/src/compaction/scheduler/planning.rs
  • Cognitive Complexity · mito2::sst::index::column::json_index_target (cognitive 21) src/mito2/src/sst/index/column.rs
  • Cognitive Complexity · servers::http::prom_store::remote_write_v2 (cognitive 21) src/servers/src/http/prom_store.rs
  • Cognitive Complexity · servers::http::prom_store::write_batched_prometheus_v2_rows_with_progress (cognitive 21) src/servers/src/http/prom_store.rs
  • Cognitive Complexity · Indexer::enforce_memory_limits (cognitive 20) src/mito2/src/sst/index.rs
  • Cognitive Complexity · RegionWorkerLoop::maybe_flush_write_regions (cognitive 20) src/mito2/src/worker/handle_flush.rs
  • Cognitive Complexity · log_store::object_store_wal::prefetch::segments (cognitive 19) src/log-store/src/object_store_wal/prefetch.rs
  • Cognitive Complexity · RegionWorkerLoop::handle_catchup_request (cognitive 18) src/mito2/src/worker/handle_catchup.rs
  • Cognitive Complexity · sql::parsers::create_parser::json::parse_json2_type_hint (cognitive 18) src/sql/src/parsers/create_parser/json.rs
  • Cognitive Complexity · query-regression-run.prepare_targets (cognitive 18) .github/scripts/query-regression-run.py
  • Cognitive Complexity · RaftEngineLogStore::read (cognitive 17) src/log-store/src/raft_engine/log_store.rs
  • Cognitive Complexity · TwcsPicker::build_candidates (cognitive 17) src/mito2/src/compaction/twcs.rs
  • Cognitive Complexity · RegionWorkerLoop::dispatch_pending_region_requests (cognitive 17) src/mito2/src/worker/handle_manifest.rs
  • Cognitive Complexity · mito2::compaction::twcs::units::pick_closed_merge_candidates (cognitive 17) src/mito2/src/compaction/twcs/units.rs
  • Cognitive Complexity · mito2::sst::parquet::prefilter::build_prefilter_masks (cognitive 17) src/mito2/src/sst/parquet/prefilter.rs
  • Cognitive Complexity · TablePendingRowsBatcher::submit (cognitive 17) src/servers/src/batcher/table.rs
  • Cognitive Complexity · RegionMetadata::validate (cognitive 17) src/store-api/src/metadata.rs
  • Cognitive Complexity · ci_scope.glob_to_regex (cognitive 17) .github/ci/ci_scope.py
  • Cognitive Complexity · ci_scope_rules.validate (cognitive 17) .github/ci/ci_scope_rules.py
  • Cognitive Complexity · query-regression-run.main (cognitive 17) .github/scripts/query-regression-run.py
  • Cognitive Complexity · TwcsPicker::pick_window (cognitive 16) src/mito2/src/compaction/twcs.rs
  • Cognitive Complexity · SingleCreator::update_flat (cognitive 16) src/mito2/src/sst/index/fulltext_index/creator.rs
  • Cognitive Complexity · Indexer::do_update (cognitive 16) src/mito2/src/sst/index/indexer/update.rs
  • Cognitive Complexity · servers::http::prom_store::remote_write_v1 (cognitive 16) src/servers/src/http/prom_store.rs
  • Cognitive Complexity · servers::otlp::metrics::exemplars::append (cognitive 16) src/servers/src/otlp/metrics/exemplars.rs
  • Cognitive Complexity · ci_scope.derive_outputs (cognitive 16) .github/ci/ci_scope.py
  • God Classes · FunctionTooLong: servers::prom_remote_write::v2::convert_remote_write_v2 src/servers/src/prom_remote_write/v2.rs
  • God Classes · FileTooLong: worker/handle_manifest.rs src/mito2/src/worker/handle_manifest.rs
  • God Classes · MethodTooLong: PagedCache.fetch src/common/cache/src/paged.rs
  • God Classes · MethodTooLong: Instance.query_exemplars_inner src/frontend/src/instance/exemplar.rs
  • God Classes · MethodTooLong: ObjectStoreWalReader.prepare src/log-store/src/object_store_wal/reader.rs
  • God Classes · ClassTooLong: ManifestContext src/mito2/src/region.rs
  • God Classes · FileTooLong: parquet/writer.rs src/mito2/src/sst/parquet/writer.rs
  • God Classes · FileTooLong: multi_region/source.rs src/mito2/src/compaction/multi_region/source.rs
  • God Classes · FileTooLong: src/metrics.rs src/mito2/src/metrics.rs
  • God Classes · MethodTooLong: AccessLayer.write_sst_inner src/mito2/src/access_layer.rs
  • God Classes · FunctionTooLong: sql::parsers::create_parser::json::parse_json2_type_hint src/sql/src/parsers/create_parser/json.rs
  • God Classes · FunctionTooLong: servers::http::prom_store::remote_write_v2 src/servers/src/http/prom_store.rs
  • God Classes · TooManyMethods: ManifestContext src/mito2/src/region.rs
  • God Classes · FileTooLong: manifest/manager.rs src/mito2/src/manifest/manager.rs
  • God Classes · ClassTooLong: TablePartitioner src/operator/src/req_convert/common/partitioner.rs
  • God Classes · FunctionTooLong: servers::http::prom_store::remote_write_v1 src/servers/src/http/prom_store.rs
  • God Classes · FunctionTooLong: servers::otlp::logs::build_otlp_logs_identity_schema src/servers/src/otlp/logs.rs
  • God Classes · ClassTooLong: CompactionScheduler src/mito2/src/compaction/scheduler.rs
  • God Classes · FileTooLong: copy_in/mod.rs src/servers/src/postgres/copy_in/mod.rs
  • God Classes · MethodTooLong: RegionWorkerLoop.handle_region_edit src/mito2/src/worker/handle_manifest.rs
  • God Classes · TooManyMethods: WorkerListener src/mito2/src/worker.rs
  • God Classes · MethodTooLong: PreparedMetrics.push_point src/servers/src/otlp/metrics/prepare.rs
  • God Classes · TooManyFields: MetasrvOptions src/meta-srv/src/metasrv.rs
  • God Classes · FunctionTooLong: frontend::instance::exemplar::collect src/frontend/src/instance/exemplar.rs
  • God Classes · FunctionTooLong: servers::http::prom_store::exemplar::write src/servers/src/http/prom_store/exemplar.rs
  • God Classes · MethodTooLong: PostgresServerHandlerInner.flush_otlp src/servers/src/postgres/copy_in/mod.rs
  • God Classes · FileTooLong: fulltext_index/applier.rs src/mito2/src/sst/index/fulltext_index/applier.rs
  • God Classes · MethodTooLong: SharedSource.build src/mito2/src/compaction/multi_region/source.rs
  • God Classes · MethodTooLong: WriteDispatcher.send_batch src/operator/src/write_dispatcher.rs
  • God Classes · MethodTooLong: RegionWorkerLoop.handle_apply_staging_manifest_request src/mito2/src/worker/handle_apply_staging.rs
  • God Classes · FileTooLong: compaction/scheduler.rs src/mito2/src/compaction/scheduler.rs
  • God Classes · FileTooLong: worker/handle_write.rs src/mito2/src/worker/handle_write.rs

We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 269 findings

These 269 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · flow::batching_mode::frontend_client::flow_write::tracked_query (cyclomatic 22) src/flow/src/batching_mode/frontend_client/flow_write.rs
  • Cyclomatic Complexity · InvertedIndexApplierBuilder::expr_to_index_target (cyclomatic 20) src/mito2/src/sst/index/inverted_index/applier/builder.rs
  • Cyclomatic Complexity · DefaultCompactor::merge_ssts (cyclomatic 17) src/mito2/src/compaction/compactor.rs
  • Cyclomatic Complexity · mito2::compaction::twcs::units::pick_closed_merge_with_budget (cyclomatic 17) src/mito2/src/compaction/twcs/units.rs
  • Cyclomatic Complexity · RegionWorkerLoop::handle_alter_request (cyclomatic 16) src/mito2/src/worker/handle_alter.rs
  • Cognitive Complexity · flow::batching_mode::frontend_client::flow_write::tracked_query (cognitive 36) src/flow/src/batching_mode/frontend_client/flow_write.rs
  • Cognitive Complexity · PageRangeCache::lookup (cognitive 28) src/mito2/src/cache.rs
  • Cognitive Complexity · ObjectStoreLogStore::read (cognitive 25) src/log-store/src/object_store_wal/store.rs
  • Cognitive Complexity · AccessLayer::write_sst (cognitive 24) src/mito2/src/access_layer.rs
  • Cognitive Complexity · MysqlInstanceShim::authenticate_with_database (cognitive 23) src/servers/src/mysql/handler.rs
  • Cognitive Complexity · InvertedIndexApplierBuilder::expr_to_index_target (cognitive 22) src/mito2/src/sst/index/inverted_index/applier/builder.rs
  • Cognitive Complexity · RegionWorkerLoop::handle_alter_request (cognitive 20) src/mito2/src/worker/handle_alter.rs
  • Cognitive Complexity · RowModifier::fill_internal_columns (cognitive 18) src/metric-engine/src/row_modifier.rs
  • Cognitive Complexity · CacheManager::get_sst_meta_data (cognitive 18) src/mito2/src/cache.rs
  • Cognitive Complexity · IndexerBuilderImpl::collect_json_inverted_index_targets (cognitive 18) src/mito2/src/sst/index.rs
  • Cognitive Complexity · RangeBase::compute_filter_mask_flat (cognitive 18) src/mito2/src/sst/parquet/file_range.rs
  • Cognitive Complexity · RegionWorkerLoop::handle_flush_finished (cognitive 17) src/mito2/src/worker/handle_flush.rs
  • Cognitive Complexity · mito2::compaction::twcs::units::pick_closed_merge_with_budget (cognitive 16) src/mito2/src/compaction/twcs/units.rs
  • Cognitive Complexity · operator::insert::flow_write::dispatch_datanode (cognitive 16) src/operator/src/insert/flow_write.rs
  • God Classes · FunctionTooLong: flow::batching_mode::frontend_client::flow_write::tracked_query src/flow/src/batching_mode/frontend_client/flow_write.rs
  • God Classes · MethodTooLong: WorkerGroup.start src/mito2/src/worker.rs
  • God Classes · TooManyMethods: Indexer src/mito2/src/sst/index.rs
  • God Classes · MethodTooLong: RegionFlushTask.flush_memtables src/mito2/src/flush.rs
  • God Classes · TooManyMethods: CacheManager src/mito2/src/cache.rs
  • God Classes · MethodTooLong: SstParquetRangeFetcher.fetch_bytes_with_cache src/mito2/src/sst/parquet/push_decoder.rs
  • God Classes · MethodTooLong: WorkerStarter.start src/mito2/src/worker.rs
  • Code Duplication · Near-duplicate member pair (59 shared lines) src/servers/src/http/prometheus.rs
  • Code Duplication · Near-duplicate member pair (52 shared lines) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs
  • Code Duplication · Near-duplicate member pair (24 shared lines) src/common/function/src/aggrs/vector/avg.rs
  • Code Duplication · Near-duplicate member pair (22 shared lines) src/common/function/src/scalars/ip/cidr.rs
  • Code Duplication · Members sharing a duplicated core (17 members, 50+ identical tokens) src/pipeline/src/etl/processor/cmcd.rs
  • Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) src/catalog/src/system_schema/information_schema/cluster_info.rs
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) src/table/src/metadata.rs
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) src/common/meta/src/key.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/cmd/src/datanode.rs
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) src/common/meta/src/key/schema_name.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/common/function/src/scalars/geo/measure.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/common/meta/src/key/table_info.rs
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) src/pipeline/src/etl/processor/decolorize.rs
  • Code Duplication · Duplicated block (30–31 lines × 2) src/mito2/src/sst/parquet/reader.rs
  • Code Duplication · Duplicated block (25 lines × 2) src/flow/src/adapter.rs
  • Code Duplication · Duplicated block (22 lines × 2) src/cmd/src/flownode.rs
  • Code Duplication · Duplicated block (21 lines × 2) src/mito2/src/read/scan_util.rs
  • Code Duplication · Duplicated block (18–21 lines × 2) src/servers/src/otlp/metrics.rs
  • Code Duplication · Duplicated block (19–20 lines × 2) src/partition/src/utils/split.rs
  • Code Duplication · Duplicated block (16–19 lines × 3) src/mito2/src/sst/index/bloom_filter/applier.rs
  • Code Duplication · Duplicated block (19 lines × 2) src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs
  • Code Duplication · Duplicated block (16–19 lines × 2) src/servers/src/otlp/metrics.rs
  • Code Duplication · Duplicated block (19 lines × 2) src/table/src/metadata.rs
  • Code Duplication · Duplicated block (18 lines × 2) src/cmd/src/flownode.rs
  • Code Duplication · Duplicated block (15–16 lines × 4) src/servers/src/otlp/metrics.rs
  • Code Duplication · Duplicated block (15–16 lines × 2) src/table/src/metadata.rs
  • Code Duplication · Duplicated block (15 lines × 4) src/catalog/src/system_schema/information_schema/region_info.rs
  • Code Duplication · Duplicated block (14–15 lines × 2) src/catalog/src/system_schema/information_schema/flow_statistics.rs
  • Code Duplication · Duplicated block (15 lines × 2) src/common/function/src/aggrs/geo/encoding.rs
  • Code Duplication · Duplicated block (15 lines × 2) src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs
  • Code Duplication · Duplicated block (15 lines × 2) src/datatypes/src/vectors/list.rs
  • Code Duplication · Duplicated block (14–15 lines × 2) src/mito2/src/cache/index/inverted_index.rs
  • Code Duplication · Duplicated block (13–15 lines × 2) src/operator/src/statement/ddl.rs
  • Code Duplication · Duplicated block (15 lines × 2) src/servers/src/http/prom_store.rs
  • Code Duplication · Duplicated block (14–15 lines × 2) src/sql/src/parsers/alter_parser/trigger.rs
  • Code Duplication · Duplicated block (14 lines × 3) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs
  • Code Duplication · Duplicated block (14 lines × 2) src/common/function/src/scalars/geo/h3.rs
  • Code Duplication · Duplicated block (12–14 lines × 2) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs
  • Code Duplication · Duplicated block (13–14 lines × 2) src/mito2/src/cache/index/bloom_filter_index.rs
  • Code Duplication · Duplicated block (14 lines × 2) src/mito2/src/engine.rs
  • Code Duplication · Duplicated block (14 lines × 2) src/servers/src/http/prometheus.rs
  • Code Duplication · Duplicated block (13 lines × 3) src/mito2/src/manifest/manager.rs
  • Code Duplication · Duplicated block (13 lines × 2) src/catalog/src/system_schema/information_schema/table_semantics.rs
  • Code Duplication · Duplicated block (13 lines × 2) src/common/datasource/src/file_format/csv.rs
  • Code Duplication · Duplicated block (13 lines × 2) src/query/src/promql/planner.rs
  • Code Duplication · Duplicated block (13 lines × 2) src/servers/src/http/prometheus.rs
  • Code Duplication · Duplicated block (12–13 lines × 2) src/sql/src/parsers/alter_parser/trigger.rs
  • Code Duplication · Duplicated block (13 lines × 2) src/sql/src/statements/copy.rs
  • Code Duplication · Duplicated block (12 lines × 3) src/cmd/src/datanode.rs
  • Code Duplication · Duplicated block (10–12 lines × 2) src/catalog/src/system_schema/information_schema/region_peers.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/common/meta/src/ddl/drop_table/executor.rs
  • Code Duplication · Duplicated block (11–12 lines × 2) src/common/meta/src/reconciliation/reconcile_logical_tables/reconcile_regions.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/common/time/src/range.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/common/time/src/range.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/mito2/src/engine.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/promql/src/extension_plan/scalar_calculate.rs
  • Code Duplication · Duplicated block (11–12 lines × 2) src/query/src/sql.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/servers/src/elasticsearch.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/servers/src/http/prometheus.rs
  • Code Duplication · Duplicated block (12 lines × 2) src/session/src/session_config.rs
  • Code Duplication · Duplicated block (11 lines × 4) src/catalog/src/system_schema/information_schema/columns.rs
  • Code Duplication · Duplicated block (11 lines × 2) src/catalog/src/system_schema/information_schema/region_info.rs
  • Code Duplication · Duplicated block (11 lines × 2) src/common/time/src/range.rs
  • Code Duplication · Duplicated block (11 lines × 2) src/mito2/src/sst/index/fulltext_index/applier.rs
  • Code Duplication · Duplicated block (9–11 lines × 2) src/mito2/src/sst/index/fulltext_index/applier/builder.rs
  • Code Duplication · Duplicated block (10–11 lines × 2) src/puffin/src/puffin_manager/stager/bounded_stager.rs
  • Code Duplication · Duplicated block (10 lines × 2) src/cli/src/data/export_v2/command.rs
  • Code Duplication · Duplicated block (10 lines × 2) src/common/macro/src/row/into_row.rs
  • Code Duplication · Duplicated block (10 lines × 2) src/common/meta/src/ddl/drop_view.rs
  • Code Duplication · Duplicated block (9–10 lines × 2) src/datanode/src/service.rs
  • Code Duplication · Duplicated block (8–10 lines × 2) src/frontend/src/instance.rs
  • Code Duplication · Duplicated block (10 lines × 2) src/mito2/src/read/scan_util.rs
  • Code Duplication · Duplicated block (10 lines × 2) src/servers/src/prom_remote_write/decode.rs
  • Code Duplication · Duplicated block (9 lines × 3) src/client/src/flow.rs
Rebuild cost: about €1,200,000 · Estimate
Cost to rebuild€380,000 to €1,900,000, for 6,370 to 20,210 hours of work, about 7.9 person-years for 4 to 15 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.8 at a score of 61. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeVery large: 911,614 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
The findings name the configuration each number was taken from and, for the assertions, the files that hold them.
Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Raises the score by about 7 points · Medium effort · Nullable reference types
2
Interpolated log message defeats structured logging
Raises the score by about 6 points · Medium effort · Structured logging
3
Resolve the 1 Yanked release finding(s) in Dependency Hygiene.
Raises the score by about 3 points · Low effort · Dependency Hygiene

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €1,200,000 to build again, about 7.9 person-years of work. Its weakest lens is Code Health, at 51 (Adequate). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.3 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 529,072 lines over the last 90 days, which is about 2,145,681 lines a year. At that pace, the extra work comes to an estimated 107.3 to 715.2 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch api api common-base common-base api->common-base common-error common-error api->common-error common-macro common-macro api->common-macro common-time common-time api->common-time datatypes datatypes api->datatypes catalog catalog catalog->api catalog->common-base catalog->common-error catalog->common-macro common-meta common-meta catalog->common-meta common-telemetry common-telemetry catalog->common-telemetry catalog->common-time catalog->datatypes store-api store-api catalog->store-api table table catalog->table cmd cmd cmd->api cmd->catalog cmd->common-base cmd->common-error cmd->common-macro cmd->common-meta cmd->common-telemetry cmd->common-time datanode datanode cmd->datanode cmd->datatypes flow flow cmd->flow frontend frontend cmd->frontend mito2 mito2 cmd->mito2 query query cmd->query servers servers cmd->servers standalone standalone cmd->standalone cmd->store-api common-meta->api common-meta->common-base common-meta->common-error common-meta->common-macro common-meta->common-telemetry common-meta->common-time common-meta->datatypes common-meta->store-api common-meta->table common-telemetry->common-base common-telemetry->common-error common-time->common-error common-time->common-macro datanode->api datanode->catalog datanode->common-base datanode->common-error datanode->common-macro datanode->common-meta datanode->common-telemetry datanode->common-time datanode->datatypes datanode->mito2 datanode->query datanode->servers datanode->store-api datanode->table datatypes->common-base datatypes->common-error datatypes->common-macro datatypes->common-telemetry datatypes->common-time flow->api flow->catalog flow->common-base flow->common-error flow->common-macro flow->common-meta flow->common-telemetry flow->common-time flow->datatypes operator operator flow->operator flow->query flow->servers flow->store-api flow->table frontend->api frontend->catalog frontend->common-base frontend->common-error frontend->common-macro frontend->common-meta frontend->common-telemetry frontend->common-time frontend->datatypes frontend->operator frontend->query frontend->servers frontend->store-api frontend->table mito2->api mito2->common-base mito2->common-error mito2->common-macro mito2->common-meta mito2->common-telemetry mito2->common-time mito2->datatypes mito2->store-api mito2->table operator->api operator->catalog operator->common-base operator->common-error operator->common-macro operator->common-meta operator->common-telemetry operator->common-time operator->datatypes operator->query operator->store-api operator->table query->api query->catalog query->common-base query->common-error query->common-macro query->common-meta query->common-telemetry query->common-time query->datatypes query->store-api query->table servers->api servers->catalog servers->common-base servers->common-error servers->common-macro servers->common-meta servers->common-telemetry servers->common-time servers->datatypes servers->operator servers->query servers->store-api servers->table standalone->api standalone->catalog standalone->common-base standalone->common-error standalone->common-macro standalone->common-meta standalone->common-telemetry standalone->common-time standalone->datanode standalone->flow standalone->frontend standalone->mito2 standalone->query standalone->servers standalone->store-api standalone->table store-api->api store-api->common-base store-api->common-error store-api->common-macro store-api->common-time store-api->datatypes table->api table->common-base table->common-error table->common-macro table->common-telemetry table->common-time table->datatypes table->store-api __more__ +50 more projects

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

1717 modules, with 4989 dependencies between them. 29 loops run through 209 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 1677 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 common_base.bytes2 common_error.status_code3 common_function.function4 common_function.function_registry5 common_meta.cluster6 common_meta.rpc7 common_procedure.procedure8 common_recordbatch.recordbatch9 table.table_name10 common_error.ext11 common_meta.ddl.drop_database12 common_time.timestamp13 meta_srv.cluster14 common_time.duration15 datatypes.value16 meta_srv.handler17 servers.http18 datatypes.data_type19 common_recordbatch20 datatypes.schema.column_schema21 store_api.storage.descriptors22 store_api.storage.requests23 table.metadata24 common_meta.key25 meta_srv.metasrv26 store_api.metadata27 store_api.storage.file28 mito2.region.options29 store_api.region_request30 mito2.sst.file31 store_api.region_engine32 common_meta.instruction33 mito2.sst.parquet.reader34 mito2.worker35 common_meta.rpc.ddl36 meta_srv.gc.procedure37 mito2.cache38 mito2.read.scan_region39 operator.statement40 frontend.instance
1 common_base.bytes
2 common_error.status_code
3 common_function.function
4 common_function.function_registry
5 common_meta.cluster
6 common_meta.rpc
7 common_procedure.procedure
8 common_recordbatch.recordbatch
9 table.table_name
10 common_error.ext3
11 common_meta.ddl.drop_database4
12 common_time.timestamp1
13 meta_srv.cluster2
14 common_time.duration1
15 datatypes.value2425
16 meta_srv.handler3321
17 servers.http1111
18 datatypes.data_type11
19 common_recordbatch31
20 datatypes.schema.column_schema1
21 store_api.storage.descriptors11
22 store_api.storage.requests1
23 table.metadata4
24 common_meta.key1131
25 meta_srv.metasrv1116111
26 store_api.metadata11225
27 store_api.storage.file1
28 mito2.region.options4111
29 store_api.region_request126
30 mito2.sst.file26511
31 store_api.region_engine12110112
32 common_meta.instruction11219321
33 mito2.sst.parquet.reader3241123
34 mito2.worker27111531
35 common_meta.rpc.ddl5231
36 meta_srv.gc.procedure43352
37 mito2.cache112211453
38 mito2.read.scan_region316133113
39 operator.statement113
40 frontend.instance1111
Uses a module listed above itPart of a loopThe module itself
1 common_base.bytes2 common_error.status_code3 common_function.function4 common_function.function_registry5 common_meta.cluster6 common_meta.rpc7 common_procedure.procedure8 common_recordbatch.recordbatch9 table.table_name10 common_error.ext11 common_meta.ddl.drop_database12 common_time.timestamp13 meta_srv.cluster14 common_time.duration15 datatypes.value16 meta_srv.handler17 servers.http18 datatypes.data_type19 common_recordbatch20 datatypes.schema.column_schema21 store_api.storage.descriptors22 store_api.storage.requests23 table.metadata24 common_meta.key25 meta_srv.metasrv26 store_api.metadata27 store_api.storage.file28 mito2.region.options29 store_api.region_request30 mito2.sst.file31 store_api.region_engine32 common_meta.instruction33 mito2.sst.parquet.reader34 mito2.worker35 common_meta.rpc.ddl36 meta_srv.gc.procedure37 mito2.cache38 mito2.read.scan_region39 operator.statement40 frontend.instancecommon_base.bytes1common_error.status_code2common_function.function3common_function.function_registry4common_meta.cluster5common_meta.rpc6common_procedure.procedure7common_recordbatch.recordbatch8table.table_name9common_error.ext10common_meta.ddl.drop_database11common_time.timestamp12meta_srv.cluster13common_time.duration14datatypes.value15meta_srv.handler16servers.http17datatypes.data_type18common_recordbatch19datatypes.schema.column_schema20store_api.storage.descriptors21store_api.storage.requests22table.metadata23common_meta.key24meta_srv.metasrv25store_api.metadata26store_api.storage.file27mito2.region.options28store_api.region_request29mito2.sst.file30store_api.region_engine31common_meta.instruction32mito2.sst.parquet.reader33mito2.worker34common_meta.rpc.ddl35meta_srv.gc.procedure36mito2.cache37mito2.read.scan_region38operator.statement39frontend.instance40341212425332111111131111141131111611111225141111262651112110112112193213241123271115315231433521122114533161331131131111+1677 more modules (most-connected shown)

At a glance — Code Health · 51% · Adequate · gated by X4, X5 ·

At a glance — Architecture · 70% · Adequate · gated by AX8 ·

At a glance — Maturity · 90% · Exemplary ·

At a glance — Readiness · 63% · Adequate · gated by P5 ·

At a glance — Security · 66% · Adequate · gated by D29, D31, D36 ·

At a glance — Domain Modelling · 91% · Exemplary ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Performance · 94% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A05:2025 — Injection484High / Critical
A03:2025 — Software Supply Chain Failures102High / Critical
A02:2025 — Security Misconfiguration82High / Critical
A07:2025 — Authentication Failures2High / Critical

Roadmap

Top priorities: The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`); Interpolated log message defeats structured logging; Resolve the 1 Yanked release finding(s) in Dependency Hygiene.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).+6.8 ptsMediumNullable reference types
Interpolated log message defeats structured logging+6.3 ptsMediumStructured logging
Resolve the 1 Yanked release finding(s) in Dependency Hygiene.+2.6 ptsLowDependency Hygiene
Remove every production → test project reference: extract any shared test helper into a production support library (which the tests reference), or invert the dependency so the test project depends on production — not the reverse.+1.6 ptsMediumTest isolation
Enable purge protection / soft-delete (and prevent_destroy on critical resources) so data stores can't be lost to an accidental or malicious delete.+1.6 ptsMediumDR & Backup
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+1.2 ptsMediumRelease Hygiene
Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key. This repository constructs a collision-broken hash (MD5/SHA1) at 2 sites, not one: `src/auth/src/common.rs:556` (`Sha1::new`), `src/auth/src/common.rs:563` (`Sha1::new`). Each is a separate decision — fixing only the line this row cites leaves the others in place.+1.2 ptsMediumWeb-Security Posture
Resolve the 1 No network policy finding(s) in Network Egress Confinement.+0.5 ptsLowNetwork Egress Confinement

File quality

Per-file score 0–10 — a quality signature. Of 938 files carrying findings, judged against the Production bar: 4% slop · 60% mixed · 36% near-clean.

FileScoreBandWorst signal
REDACTED0.9SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED1.1SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.3SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.4SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.4SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.6SlopIaC & Container Security: High IaC: REDACTED
REDACTED1.6SlopIaC & Container Security: High IaC: REDACTED
src/mito2/src/engine.rs1.7SlopChange Coupling: Boundary-crossing change coupling: engine.rs ↔ test_util.rs
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 559

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 2983

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 334

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 9

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 62 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 62 dimensions across the health lenses
D1D2D3D4D5D6D7D10D12D13D14D15D16D17D19D20D26D28D29D30D31D34D35D36D37D40D41D43D44AX10AX3AX4AX8AX9C2DM4DM5DM6ES2M1M2M3M4P1P10P2P3P4P5P6P7PF1PF3S1X1X14X21X28X29X30X4X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 3726 of 3876 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic

Every finding is locatable in findings.md. Run 01a1db35-a588-7dee-9b48-f30ce425efa4.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo — a Codecov configuration (codecov.yml) and a coverage step in CI (`cargo llvm-cov`) shows coverage is measured in your own CI.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 4 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 228 test source file(s) (.rs, .py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.rs, .py, .ts) and this repository declares a Cargo test suite (repository root, 1381 test files), but it was not re-run: its build outgrew the 6 GB scratch ceiling (6.041 GB measured) and was stopped; its suite was not run. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D27 Navigability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `.github/scripts/query-regression-comment.cjs` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Rust is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P8 Schema migrations — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 4 further occurrence(s) are not listed individually; the score already reflects all 44.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X4 Structured logging — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 968 further occurrence(s) are not listed individually; the score already reflects all 1008.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
  • D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity5.7 / 10Adequate✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 5.7 / 10 · rule-coverage 100% · ceiling Prevented

174 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was servers::postgres::types::parameters_to_scalar_values at 131. A further 82 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being Error::status_code at 83 — they are counted neither in the figure above nor in this dimension's score. 41 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: src/mito2/src/error.rs (Error::status_code at 83), src/operator/src/error.rs (Error::status_code at 59), src/sql/src/statements/statement.rs (Statement::fmt at 53), src/catalog/src/system_schema/information_schema.rs (InformationSchemaProvider::information_table at 46), src/meta-srv/src/error.rs (Error::status_code at 42), and 36 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

servers::postgres::types::parameters_to_scalar_values (cyclomatic 131) · ×18src/servers/src/postgres/types.rs:574
RegionWorkerLoop::run (cyclomatic 23) · ×9src/mito2/src/worker.rs:1291
PromPlanner::create_function_expr (cyclomatic 106) · ×8src/query/src/promql/planner.rs:3578
mito2::read::seq_scan::build_flat_sources (cyclomatic 23) · ×8src/mito2/src/read/seq_scan.rs:683
ParserContext::parse_show (cyclomatic 39) · ×5src/sql/src/parsers/show_parser.rs:38

+ 94 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 7 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with servers::postgres::types::parameters_to_scalar_values (cyclomatic 131), PromPlanner::create_function_expr (cyclomatic 106), operator::req_convert::common::push_column_to_rows (cyclomatic 94). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 7 together lifts Cyclomatic Complexity from 5.7 to about 6.5/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity5.2 / 10Adequate✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 5.2 / 10 · rule-coverage 100% · ceiling Prevented

397 method(s) exceeded the cognitive complexity threshold of 15; the worst was servers::postgres::types::parameters_to_scalar_values at 205.

servers::postgres::types::parameters_to_scalar_values (cognitive 205) · ×29src/servers/src/postgres/types.rs:574
mito2::read::seq_scan::build_flat_sources (cognitive 36) · ×23src/mito2/src/read/seq_scan.rs:683
RegionWorkerLoop::run (cognitive 40) · ×15src/mito2/src/worker.rs:1291
PromPlanner::create_function_expr (cognitive 139) · ×11src/query/src/promql/planner.rs:3578
operator::req_convert::common::push_column_to_rows (cognitive 187) · ×10src/operator/src/req_convert/common.rs:202

+ 210 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 6 bodies over 120 down to 120 or less in Cognitive Complexity — start with servers::postgres::types::parameters_to_scalar_values (cognitive 205), operator::req_convert::common::push_column_to_rows (cognitive 187), servers::otlp::metrics::prepare::prepare_metrics (cognitive 172). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 6 together lifts Cognitive Complexity from 5.3 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes8.9 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 8.9 / 10 · rule-coverage 100% · ceiling Prevented

380 god class(es) detected.

FileTooLong: promql/planner.rs · ×149src/query/src/promql/planner.rs
MethodTooLong: PromPlanner.or_operator · ×102src/query/src/promql/planner/set_operator.rs:43
ClassTooLong: PromPlanner · ×53src/query/src/promql/planner.rs:290
FunctionTooLong: servers::postgres::types::parameters_to_scalar_values · ×43src/servers/src/postgres/types.rs:574
TooManyMethods: ParserContext · ×25src/sql/src/parser.rs:43

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 149 FileTooLong finding(s) in God Classes — start with error.rs (6), handler.rs (4), prom_store.rs (3). — One of this dimension's main actionable groups (149 warning-level).
  2. Resolve the 102 MethodTooLong finding(s) in God Classes — start with planner.rs (9), error.rs (6), task.rs (4). — One of this dimension's main actionable groups (102 warning-level).
  3. Resolve the 53 ClassTooLong finding(s) in God Classes — start with error.rs (8), planner.rs (2), store.rs (2). — One of this dimension's main actionable groups (53 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication8.5 / 10Strong✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

Maturity: Documented → Verified → Prevented · effective 8.5 / 10 · rule-coverage 100% · ceiling Verified

750 duplicated block group(s) detected. 3.8 % of the production lines (34,427 of 911,614) are in a reported copy. A further 591 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 132 of the 1341 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (7 lines × 2) · ×55src/catalog/src/system_schema/information_schema/flows.rs:165
Duplicated block (11 lines × 2) · ×51src/catalog/src/memory/manager.rs:325
Duplicated block (9 lines × 2) · ×49src/api/src/v1/column_def.rs:288
Duplicated block (10 lines × 2) · ×48src/cli/src/data/export_v2/command.rs:531
Duplicated block (8 lines × 2) · ×43src/catalog/src/system_schema/information_schema/partitions.rs:311

+ 270 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 55 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with planner.rs (4), binary.rs (4), utils.rs (2). — One of this dimension's main actionable groups (55 warning-level).
  2. Resolve the 51 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with create_parser.rs (3), manager.rs (2), flownode.rs (2). — One of this dimension's main actionable groups (51 warning-level).
  3. Resolve the 49 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with builder.rs (3), REDACTED (2), repartition.rs (2). — One of this dimension's main actionable groups (49 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling7.6 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 7.6 / 10 · rule-coverage 100% · ceiling Prevented

70 production modules (Cargo+npm), 0 dependency cycle(s), 15 unstable depended-on module(s). Read from the build's own module declarations; 10 module(s) off the main sequence, with abstractness counted on 62 of the 70 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: api · ×2
Unstable project cli
Unstable project common-grpc-expr
Unstable project datanode
Unstable project flow

+ 12 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 Unstable project cli finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Unstable project common-grpc-expr finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)9.9 / 10Stronggated by 12 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Verified

12 of 1303 classes have LCOM4 above 3.

Low cohesion: MockKvBackend (LCOM4 7) · ×12src/common/meta/src/kv_backend/test_util.rs:37

What to do

  1. Resolve the 12 Low cohesion finding(s) in Cohesion (LCOM4) — start with test_util.rs, state.rs, builder.rs. — One of this dimension's main actionable groups (12 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D7 · Architectural Integrity6.0 / 10Adequate✓ Tool-verified

What it measures: Whether the code respects its intended layering / architecture rules.

Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Prevented

No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).

Detailed fixes: d7_recommendation.md.

D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 4 tests. Measured on the JavaScript/TypeScript suite only — at least 228 test source file(s) (.rs, .py) went unread, so its test quality is unmeasured and is not in these counts.

✓ On the Gold path — maintain.

Detailed fixes: d10_recommendation.md.

D12 · Dependency Hygiene7.5 7.4 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

Maturity: Documented → Verified → Prevented · effective 7.4 / 10 · rule-coverage 99% · ceiling Verified

83 outdated, 1 yanked direct Cargo dependencies. 245 of 248 direct crates were graded against crates.io (0 not published there, 3 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.

Yanked release: mysql
Outdated: anyhow · ×83

What to do

  1. Resolve the 1 Yanked release finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · REDACTED Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

REDACTED scan ran and found no leaked secrets. 1 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 1299 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. A further 57 crate(s) in the closure resolve from git, a path or a private registry and publish no licence this pass can read; they are outside this verdict. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.8 / 10Stronggated by 77 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: src/query/src/promql/planner.rs (26×106=2756); src/operator/src/insert.rs (27×61=1647); src/mito2/src/region.rs (27×25=675) Repeated repair below the complexity floor: src/mito2/src/compaction/twcs.rs (6 of 10 changes were fixes); src/servers/src/prom_store.rs (6 of 10 changes were fixes); src/mito2/src/region_write_ctx.rs (6 of 9 changes were fixes)

Hotspot: src/query/src/promql/planner.rs · ×53src/query/src/promql/planner.rs:3578
Repeated repair: src/mito2/src/compaction/twcs.rs · ×24src/mito2/src/compaction/twcs.rs:386

What to do

  1. Resolve the 53 Hotspot finding(s) in Churn × Complexity Hotspots — start with handler.rs (2), command.rs (2), planner.rs. — One of this dimension's main actionable groups (53 warning-level).
  2. Resolve the 24 Repeated repair finding(s) in Churn × Complexity Hotspots — start with twcs.rs, prom_store.rs, region_write_ctx.rs. — One of this dimension's main actionable groups (24 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.2 / 10Exemplary✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Documented

147 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src/log-store/src/object_store_wal/store.rs. Counted over 1709 of the 2089 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×9
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt9.9 / 10Stronggated by 405 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Prevented

405 deducted task-comment markers across 911614 LoC (0.0/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×384tests-integration/tests/http.rs:6015
FixmeComment · ×16tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs:167
HackComment · ×5src/mito2/src/region.rs:750

What to do

  1. Resolve the 384 TodoComment finding(s) in Explicit Debt — start with planner.rs (15), engine.rs (8), client.rs (8). — One of this dimension's main actionable groups (384 warning-level).
  2. Resolve the 16 FixmeComment finding(s) in Explicit Debt — start with creator.rs (2), datanode_table.rs (2), fuzz_create_table_standalone.rs. — One of this dimension's main actionable groups (16 warning-level).
  3. Resolve the 5 HackComment finding(s) in Explicit Debt — start with region.rs, region_server.rs, chroot.rs. — One of this dimension's main actionable groups (5 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 1 documentation facets pass in full. 48 document(s) read across 3 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality6.5 / 10Adequate✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

Maturity: Documented → Verified → Prevented · effective 6.5 / 10 · rule-coverage 100% · ceiling Documented

11 of 29 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question, a date that is no calendar day). How well each record argues its case is not measured.

ADR has no Decision and Consequences section · ×9docs/rfcs/2022-12-20-promql-in-rust/rfc.md:11detected by adr-integrity
ADR considers only one optiondocs/rfcs/2023-05-09-distributed-planner.md:133detected by adr-integrity
ADR has no Decision sectiondocs/rfcs/2025-07-23-global-gc-worker.md:8detected by adr-integrity

What to do

  1. Resolve the 9 ADR has no Decision and Consequences section finding(s) in ADR Quality — start with rfc.md, 2023-01-03-procedure-framework.md, 2023-12-22-enclose-column-id.md. — One of this dimension's main actionable groups (9 recommendation-level).
  2. Resolve the 1 ADR considers only one option finding(s) in ADR Quality — start with 2023-05-09-distributed-planner.md. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 ADR has no Decision section finding(s) in ADR Quality — start with 2025-07-23-global-gc-worker.md. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion7.2 / 10Strong✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 7.2 / 10 · rule-coverage 100% · ceiling Documented

10 of 71 build units (Cargo, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 9.0 / 10 · rule-coverage 100% · ceiling Documented

1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

484 finding(s): 0 critical, 476 high, 8 medium, 0 low. 325 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 14 file(s) — `.github/scripts/find-previous-workflow-artifact.sh` (line 137, line 141, line 158), `.github/scripts/oswal-s3-bench-run.sh` (lines 108–487), `.github/scripts/query-regression-comment.cjs` (line 52), `REDACTED` (line 28), `scripts/check-builder-rust-version.sh` (line 57), … (+9 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 26 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 12 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 46 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (8), REDACTED (8), REDACTED (8). — One of this dimension's main actionable groups (46 issue-level).
  2. Resolve the 40 REDACTED finding(s) charged to Static Analysis (SAST) — the other 325 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (365 issue-level, 40 of them charged here).
  3. Resolve the 32 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (24), REDACTED (4), REDACTED (4). — One of this dimension's main actionable groups (32 issue-level).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

80 finding(s): 0 critical, 5 high, 75 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 24 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (24). — One of this dimension's main actionable groups (24 warning-level).
  2. Resolve the 20 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (19), REDACTED. — One of this dimension's main actionable groups (20 warning-level).
  3. Resolve the 5 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (5 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security0.0 / 10Critical✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

82 finding(s): 0 critical, 43 high, 27 medium, 12 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 43 High IaC finding(s) in IaC & Container Security — start with REDACTED (39), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (43 issue-level).
  2. Resolve the 27 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (19), REDACTED (6), REDACTED. — One of this dimension's main actionable groups (27 warning-level).
  3. Resolve the 12 Low IaC finding(s) in IaC & Container Security — start with REDACTED (6), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (12 recommendation-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness9.4 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Documented

97 of 1709 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/index/src/bitmap.rs. Counted over 1709 of the 2089 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgesrc/index/src/bitmap.rs:1
Orphaned file · ×96src/datatypes/src/vectors/decimal.rs:1
Further orphaned files (smaller)

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with bitmap.rs. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 96 Orphaned file finding(s) in Knowledge Freshness — start with error.rs (5), REDACTED (3), blob.rs (2). — One of this dimension's main actionable groups (96 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.4 / 10Adequategated by 29 critical findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: table_names.rs↔consts.rs 100%; export.rs↔import.rs 100%; seq_scan.rs↔unordered_scan.rs 95%

Boundary-crossing change coupling: table_names.rs ↔ consts.rs · ×29src/catalog/src/system_schema/information_schema/table_names.rs:1
Change coupling: export.rs ↔ import.rs · ×33src/cli/src/data/export.rs:1
Change-coupling hub: unordered_scan.rs → range.rs, seq_scan.rs, series_scan.rs · ×4src/mito2/src/read/unordered_scan.rs

What to do

  1. Resolve the 29 Boundary-crossing change coupling finding(s) in Change Coupling — start with engine.rs (2), REDACTED (2), etcd.rs (2). — One of this dimension's main actionable groups (29 issue-level).
  2. Resolve the 33 Change coupling finding(s) in Change Coupling — start with failure_handler.rs (2), export.rs, region_lease_handler.rs. — One of this dimension's main actionable groups (33 warning-level).
  3. Resolve the 4 Change-coupling hub finding(s) in Change Coupling — start with unordered_scan.rs, collect_leader_region_handler.rs, finish.rs. — One of this dimension's main actionable groups (4 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

0/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 6 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 7 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 6 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (6 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D40 · Network Egress Confinement6.0 / 10Adequate✓ Tool-verified

What it measures: Whether Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.

Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

0/2 network-egress controls present (network policy, egress restriction).

No network policy

What to do

  1. Resolve the 1 No network policy finding(s) in Network Egress Confinement. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d40_recommendation.md · top locations in Appendix A, every location in findings.md.

D41 · Kernel & Syscall Confinement6.0 / 10Adequate✓ Tool-verified

What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.

Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

0/1 workload(s) run every container under a seccomp profile; 0/1 declare an AppArmor/SELinux profile.

No seccomp profileREDACTED:2

What to do

  1. Resolve the 1 No seccomp profile finding(s) in Kernel & Syscall Confinement — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d41_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition9.4 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX8 · Test isolation2.5 / 10Weak✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

  • `file-engine` (production) references the test project `common-test-util`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `mito2` (production) references the test project `common-test-util`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • `puffin` (production) references the test project `common-test-util`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.

What to do

  • Remove every production → test project reference: extract any shared test helper into a production support library (which the tests reference), or invert the dependency so the test project depends on production — not the reverse.
AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

C2 · Access Controls10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

DM4 · Rich vs anemic domain model8.0 / 10Strong✓ Tool-verified

Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.

Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.

Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.

  • `DroppedTableLifecycle` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside. — src/common/meta/src/key.rs:484

What to do

  • Move the domain logic onto the entity (invariant-enforcing `&mut self` commands) instead of a foreign service.
DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.

Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.

Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.

DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (diesel/sea-orm/sqlx) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

ES2 · Immutable events10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.

Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.

M1 · Documentation (README)7.4 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

  • 1 public type in `common_event_recorder.recorder` is marked as implementation by its own namespace, folder or name: `EventRecorderImpl` (src/common/event-recorder/src/recorder.rs:323, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/common/event-recorder/src/recorder.rs:323
  • 1 public type in `common_meta.kv_backend.rds` is marked as implementation by its own namespace, folder or name: `ExecutorImpl` (src/common/meta/src/kv_backend/rds.rs:147, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/common/meta/src/kv_backend/rds.rs:147
  • 1 public type in `common_stat.resource` is marked as implementation by its own namespace, folder or name: `ResourceStatImpl` (src/common/stat/src/resource.rs:96, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/common/stat/src/resource.rs:96
  • 1 public type in `frontend.events` is marked as implementation by its own namespace, folder or name: `EventHandlerImpl` (src/frontend/src/events.rs:30, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/frontend/src/events.rs:30
  • 1 public type in `index.bloom_filter.reader` is marked as implementation by its own namespace, folder or name: `BloomFilterReaderImpl` (src/index/src/bloom_filter/reader.rs:210, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/index/src/bloom_filter/reader.rs:210
  • 2 public types in `log_store.kafka` are marked as implementation by their own namespace, folder or name: `NamespaceImpl` (src/log-store/src/kafka.rs:31, name ends in `Impl`), `EntryImpl` (src/log-store/src/kafka.rs:38, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — src/log-store/src/kafka.rs:31
  • 1 public type in `meta_srv.event` is marked as implementation by its own namespace, folder or name: `EventHandlerImpl` (src/meta-srv/src/event.rs:30, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/meta-srv/src/event.rs:30
  • 1 public type in `meta_srv.metasrv` is marked as implementation by its own namespace, folder or name: `BackendImpl` (src/meta-srv/src/metasrv.rs:100, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/meta-srv/src/metasrv.rs:100
  • 1 public type in `mito2.flush` is marked as implementation by its own namespace, folder or name: `WriteBufferManagerImpl` (src/mito2/src/flush.rs:118, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/mito2/src/flush.rs:118
  • 1 public type in `operator.statement` is marked as implementation by its own namespace, folder or name: `InserterImpl` (src/operator/src/statement.rs:983, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/operator/src/statement.rs:983
  • 1 public type in `plugins.options` is marked as implementation by its own namespace, folder or name: `PluginOptionsDeserializerImpl` (src/plugins/src/options.rs:39, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — src/plugins/src/options.rs:39

What to do

  • Hide `common_event_recorder.recorder` (`EventRecorderImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `common_meta.kv_backend.rds` (`ExecutorImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `common_stat.resource` (`ResourceStatImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `frontend.events` (`EventHandlerImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `index.bloom_filter.reader` (`BloomFilterReaderImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `log_store.kafka` (`NamespaceImpl`, `EntryImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `meta_srv.event` (`EventHandlerImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `meta_srv.metasrv` (`BackendImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `mito2.flush` (`WriteBufferManagerImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `operator.statement` (`InserterImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
  • Hide `plugins.options` (`PluginOptionsDeserializerImpl`) (Rust: `pub(crate)`, or keep the module private): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
P2 · Observability10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

P3 · Security & performance tooling6.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

  • `.github/scripts/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — .github/scripts/package.json:6

What to do

  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P5 · DR & Backup3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

What to do

  • Enable purge protection / soft-delete (and prevent_destroy on critical resources) so data stores can't be lost to an accidental or malicious delete.
P6 · Release Hygiene5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
P7 · Outbound HTTP resilience10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

PF1 · Benchmark discipline9.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

S1 · Web-Security Posture6.0 / 10Adequate✓ Tool-verified

Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. This repository serves HTTP itself (`axum::serve(` (src/servers/src/http.rs:1684)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call. (×2) — src/auth/src/common.rs:556, src/auth/src/common.rs:563
  • None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (src/servers/src/http.rs:1684).

What to do

  • Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key. This repository constructs a collision-broken hash (MD5/SHA1) at 2 sites, not one: `src/auth/src/common.rs:556` (`Sha1::new`), `src/auth/src/common.rs:563` (`Sha1::new`). Each is a separate decision — fixing only the line this row cites leaves the others in place.
  • Set security response headers on what the server sends — actix-web's `DefaultHeaders::new().add((header::X_CONTENT_TYPE_OPTIONS, "nosniff"))`, tower-http's `SetResponseHeaderLayer::overriding(…)` on an axum router, or keep Rocket's default `Shield` — with `Content-Security-Policy`, `X-Content-Type-Options` and a frame policy on every response.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging2.9 / 10Weak✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `warn!` at line 33 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/addrs.rs:33
  • `debug!` at line 137 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/elasticsearch.rs:137
  • `debug!` at line 393 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/elasticsearch.rs:393
  • `info!` at line 109 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/grpc.rs:109
  • `error!` at line 113 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/grpc.rs:113
  • `info!` at line 387 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/grpc.rs:387
  • `warn!` at line 412 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/grpc.rs:412
  • `info!` at line 1659 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http.rs:1659
  • `info!` at line 1710 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http.rs:1710
  • `error!` at line 135 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/otel_arrow.rs:135
  • `info!` at line 103 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/server.rs:103
  • `info!` at line 126 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/server.rs:126
  • `error!` at line 175 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/server.rs:175
  • `info!` at line 180 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/server.rs:180
  • `info!` at line 207 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/server.rs:207
  • `debug!` at line 854 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/postgres/handler.rs:854
  • `info!` at line 855 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/postgres/handler.rs:855
  • `debug!` at line 165 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/postgres/server.rs:165
  • `debug!` at line 169 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/postgres/server.rs:169
  • `debug!` at line 27 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/postgres/utils.rs:27
  • `info!` at line 904 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/postgres/copy_in/mod.rs:904
  • `error!` at line 196 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:196
  • `debug!` at line 434 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:434
  • `debug!` at line 460 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:460
  • `debug!` at line 465 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. (×2) — src/servers/src/mysql/handler.rs:465, src/servers/src/mysql/writer.rs:465
  • `debug!` at line 610 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:610
  • `debug!` at line 642 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:642
  • `debug!` at line 722 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:722
  • `debug!` at line 981 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:981
  • `debug!` at line 1014 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/handler.rs:1014
  • `debug!` at line 194 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/server.rs:194
  • `debug!` at line 184 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/mysql/writer.rs:184
  • `warn!` at line 47 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/client_ip.rs:47
  • `debug!` at line 37 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/dashboard.rs:37
  • `info!` at line 52 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/dyn_log.rs:52
  • `warn!` at line 413 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/event.rs:413
  • `warn!` at line 425 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/event.rs:425
  • `warn!` at line 970 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/event.rs:970
  • `debug!` at line 386 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — src/servers/src/http/jaeger.rs:386

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types2.0 / 10Critical✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • 0/1 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health51%Adequate — gated by X4, X5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture70%Adequate — gated by AX8Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity90%ExemplarySolid.
Readiness63%Adequate — gated by P5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security66%Adequate — gated by D29, D31, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling91%ExemplarySolid.
Event Sourcing100%ExemplaryStrongest area.
Performance94%ExemplarySolid.
Unscored — 6 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • AXH1 Runtime security headers — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXI1 Runtime container hardening — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility (rendered) — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 7 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 61 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — no exported interface declares behaviour
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXA1 Runtime unauthenticated reachability — This run crawled public routes only — it had no logged-in session, so there is no authenticated surface to compare anonymous access against and nothing was measured. This is a statement about this run, not about your application: nothing here says access control is missing, and nothing here says it is present.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXS1 Runtime exposed surface — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no data at rest for these controls to protect.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Diesel schema, a SeaORM entity, a Diesel or sqlx row struct, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store crate (sqlx, Diesel, SeaORM, rusqlite, tokio-postgres, MongoDB, …) in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D21 Naming Consistency — D21 withholds its sibling role token rows: 3 candidate(s) found and not reported.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
  • D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D32 Data Compliance (PII/GDPR) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D42 Runtime Threat Enforcement — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
  • D8 Code Coverage — Coverage not measured — Rust suite
  • DM1 Aggregate boundaries — this Rust crate declares no domain aggregate (a struct with private state and its own command methods), so DM1's aggregate-boundary read has no population to be taken over
  • DM2 Strongly-typed ids — the crate defines newtype typed-ids but declares no domain aggregate that could carry an id — so DM2's adoption ratio has no population to be taken over
  • DM3 Integration-event coupling — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
  • DM7 Repository granularity — not applicable: no DDD domain layer was detected (no aggregate, entity or value-object structure), so there is no domain model for this card to grade
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Fold determinism — not applicable — the code was read and holds no event-replay fold, so there is nothing for this check to judge
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • P8 Schema migrations — sqlx is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X12 Unreachable branch — X12 reached only 0% of this repository's production lines — rust (911,229 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. Rust's compiler refuses the unsynchronised version: a collection shared between a callback's thread and the waiting body must be `Sync`, which a `Vec`, `VecDeque` or `HashMap` is only behind a `Mutex`/`RwLock`, so the race this check looks for cannot be written in safe Rust. TypeScript/JavaScript runs every callback on the one thread that owns its objects: a callback runs only when the body waiting on it has yielded, never alongside it, and a worker thread receives a COPY of what it is sent. A SharedArrayBuffer carries raw bytes, never an Array, Map or Set, so no collection is reachable from two threads at once. Not a gap in the analyzer and not a finding about your code.
  • X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X3 Exception handling — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 559 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 340 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 21 more in this group — see findings.md.
D31 · IaC & Container Security · High IaC · ×43
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 18 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 7 more in this group — see findings.md.
D35 · Change Coupling · Boundary-crossing change coupling · ×29
  • Boundary-crossing change coupling: table_names.rs ↔ consts.rs src/catalog/src/system_schema/information_schema/table_names.rs:1 — `src/catalog/src/system_schema/information_schema/table_names.rs` (context catalog) and `src/common/catalog/src/consts.rs` (context common) sit in DIFFERENT parts of the tree yet change together 100% of the time (23 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 23 shared commits counted here, the most recent 3 are `8bdb7d55` feat: add information_schema.compaction_tasks (#10173); `7cbd20a0` fix(mysql): strip leading comments before the federated statement fil…; `cabc2f6c` feat(flow): add information_schema.flow_statistics and SHOW FLOW STAT… — run `git show` on any of them.
  • Boundary-crossing change coupling: engine.rs ↔ test_util.rs src/file-engine/src/engine.rs:1 — `src/file-engine/src/engine.rs` (context file-engine) and `src/query/src/optimizer/test_util.rs` (context query) sit in DIFFERENT parts of the tree yet change together 83% of the time (10 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `89a5df31` fix: ignore stale leader grants after a region is downgraded (#9987); `91a59b82` fix: acknowledge writes only within the region's leader lease (#9904); `294f19fa` feat(metric-engine): support sync logical regions from source region … — run `git show` on any of them.
  • Boundary-crossing change coupling: REDACTED ↔ test_util.rs src/datanode/src/tests.rs:1 — `src/datanode/src/tests.rs` (context datanode) and `src/query/src/optimizer/test_util.rs` (context query) sit in DIFFERENT parts of the tree yet change together 83% of the time (10 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `89a5df31` fix: ignore stale leader grants after a region is downgraded (#9987); `91a59b82` fix: acknowledge writes only within the region's leader lease (#9904); `294f19fa` feat(metric-engine): support sync logical regions from source region … — run `git show` on any of them.
  • Boundary-crossing change coupling: engine.rs ↔ test_util.rs src/mito2/src/engine.rs:1 — `src/mito2/src/engine.rs` (context mito2) and `src/query/src/optimizer/test_util.rs` (context query) sit in DIFFERENT parts of the tree yet change together 83% of the time (10 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `89a5df31` fix: ignore stale leader grants after a region is downgraded (#9987); `91a59b82` fix: acknowledge writes only within the region's leader lease (#9904); `294f19fa` feat(metric-engine): support sync logical regions from source region … — run `git show` on any of them.
  • Boundary-crossing change coupling: seq_scan.rs ↔ parallelize_scan.rs src/mito2/src/read/seq_scan.rs:1 — `src/mito2/src/read/seq_scan.rs` (context mito2) and `src/query/src/optimizer/parallelize_scan.rs` (context query) sit in DIFFERENT parts of the tree yet change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `b32ca3ad` perf: parallelize file source region (#7285); `c7e94855` feat: New scanner `SeriesScan` to scan by series for querying metrics…; `73ca39f3` feat: time series distribution in scanner (#5675) — run `git show` on any of them.
  • Boundary-crossing change coupling: etcd.rs ↔ metasrv.rs src/common/meta/src/election/etcd.rs:1 — `src/common/meta/src/election/etcd.rs` (context common) and `src/meta-srv/src/metasrv.rs` (context meta-srv) sit in DIFFERENT parts of the tree yet change together 71% of the time (15 of the 21 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `c8c2e09e` refactor: move election trait and implementations to the `common-meta…; `cb0f1afb` fix: improve network failure detection (#7382) (at that commit the file was still `src/meta-srv/src/election/etcd.rs`); `16febbd4` feat: add CPU, memory and node status info to `cluster_info` (#6897) (at that commit the file was still `src/meta-srv/src/election/etcd.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: collect_leader_region_handler.rs ↔ region.rs src/meta-srv/src/handler/collect_leader_region_handler.rs:1 — `src/meta-srv/src/handler/collect_leader_region_handler.rs` (context meta-srv) and `src/mito2/src/region.rs` (context mito2) sit in DIFFERENT parts of the tree yet change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `4e5b60b8` refactor: rename flushed_parquet_bytes to ingested_parquet_bytes (#10…; `fbbc017b` feat: expose region min/max timestamp in region_statistics (#9060); `2dc6addb` feat: report region query stats in heartbeat (#8401) — run `git show` on any of them.
  • Boundary-crossing change coupling: copy.rs ↔ requests.rs src/sql/src/statements/copy.rs:1 — `src/sql/src/statements/copy.rs` (context sql) and `src/table/src/requests.rs` (context table) sit in DIFFERENT parts of the tree yet change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `2ad50332` feat: impl COPY a query resultset to external file (#5250); `f93b5b19` feat: limit total rows copied in COPY TABLE FROM with LIMIT segment (…; `16c1ee26` feat: incremental database backup (#1240) — run `git show` on any of them.
  • Boundary-crossing change coupling: REDACTED ↔ engine.rs src/datanode/src/tests.rs:1 — `src/datanode/src/tests.rs` (context datanode) and `src/file-engine/src/engine.rs` (context file-engine) sit in DIFFERENT parts of the tree yet change together 65% of the time (15 of the 23 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `89a5df31` fix: ignore stale leader grants after a region is downgraded (#9987); `91a59b82` fix: acknowledge writes only within the region's leader lease (#9904); `294f19fa` feat(metric-engine): support sync logical regions from source region … — run `git show` on any of them.
  • Boundary-crossing change coupling: memory.rs ↔ backend.rs src/common/meta/src/kv_backend/memory.rs:1 — `src/common/meta/src/kv_backend/memory.rs` (context common) and `src/log-store/src/raft_engine/backend.rs` (context log-store) sit in DIFFERENT parts of the tree yet change together 64% of the time (9 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `3d9df822` refactor: refactor `PgStore` (#5309); `72897a20` chore: minor refactor on etcd kvbackend (#3940); `a260ba3e` feat: use txn to impl cas (#3936) — run `git show` on any of them.
  • Boundary-crossing change coupling: scan_region.rs ↔ parallelize_scan.rs src/mito2/src/read/scan_region.rs:1 — `src/mito2/src/read/scan_region.rs` (context mito2) and `src/query/src/optimizer/parallelize_scan.rs` (context query) sit in DIFFERENT parts of the tree yet change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `0c30bf1a` feat: add a subcommand to bench scan (#7722); `c7e94855` feat: New scanner `SeriesScan` to scan by series for querying metrics…; `73ca39f3` feat: time series distribution in scanner (#5675) — run `git show` on any of them.
  • Boundary-crossing change coupling: log_handler.rs ↔ pipeline_operator.rs src/frontend/src/instance/log_handler.rs:1 — `src/frontend/src/instance/log_handler.rs` (context instance) and `src/pipeline/src/manager/pipeline_operator.rs` (context pipeline) sit in DIFFERENT parts of the tree yet change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `0cb70d4f` fix: tolerate invalid UTF-8 in JSON log ingestion (#10245); `ad823db0` fix(pipeline)!: disable VRL host access by default (#9610); `7274ceba` feat: Add query pipeline http api (#5819) — run `git show` on any of them.
  • Boundary-crossing change coupling: region_request.rs ↔ alter_parser.rs src/common/meta/src/ddl/alter_table/region_request.rs:1 — `src/common/meta/src/ddl/alter_table/region_request.rs` (context common) and `src/sql/src/parsers/alter_parser.rs` (context sql) sit in DIFFERENT parts of the tree yet change together 60% of the time (9 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `045441e3` feat(json2): support altering JSON2 settings (#9029); `b6cef77a` feat: add `SET DEFAULT` syntax (#6421); `438791b3` feat: Add `DROP DEFAULT` (#6290) — run `git show` on any of them.
  • Boundary-crossing change coupling: upgrade_region.rs ↔ upgrade_candidate_region.rs src/datanode/src/heartbeat/handler/upgrade_region.rs:1 — `src/datanode/src/heartbeat/handler/upgrade_region.rs` (context datanode) and `src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs` (context meta-srv) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6960a018` refactor: add support for batch region upgrade operations part1 (#7155); `7cf47ccf` fix: initialize remote WAL regions with correct flushed entry IDs (#6…; `5a36fa5e` fix: alway rejects write while downgrading region (#5842) — run `git show` on any of them.
  • Boundary-crossing change coupling: table_route.rs ↔ downgrade_leader_region.rs src/common/meta/src/key/table_route.rs:1 — `src/common/meta/src/key/table_route.rs` (context common) and `src/meta-srv/src/procedure/region_migration/update_metadata/downgrade_leader_region.rs` (context meta-srv) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `dcae2120` chore: refresh route table (#4673); `a8cbec82` refactor: refactor TableRouteManager (#3392); `4460af80` feat(TableRouteValue): add panic notes and type checks (#3031) — run `git show` on any of them.
  • Boundary-crossing change coupling: prom_store.rs ↔ test_util.rs src/frontend/src/service_config/prom_store.rs:1 — `src/frontend/src/service_config/prom_store.rs` (context service_config) and `tests-integration/src/test_util.rs` (context tests-integration) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `20dde260` feat: enable native histogram ingestion by default (#9301); `aa725637` refactor!: move native histogram config and `prom_validation_mode` to…; `c8f65c7b` feat: update flow windows after metric batch flush (#8544) — run `git show` on any of them.
  • Boundary-crossing change coupling: objbench.rs ↔ write_cache.rs src/cmd/src/datanode/objbench.rs:1 — `src/cmd/src/datanode/objbench.rs` (context cmd) and `src/mito2/src/cache/write_cache.rs` (context mito2) sit in DIFFERENT parts of the tree yet change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `54b6bd5b` feat(mito2): support extension index providers and input reuse (#10297); `f5212d36` feat(mito2): add write cache upload hook (#8992); `abf46234` refactor: store the schema of flat source (#8091) — run `git show` on any of them.
  • Boundary-crossing change coupling: jaeger.rs ↔ v0.rs src/frontend/src/instance/jaeger.rs:1 — `src/frontend/src/instance/jaeger.rs` (context instance) and `src/servers/src/otlp/trace/v0.rs` (context servers) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6caff50d` chore: improve search traces and jaeger resp (#7166); `0a396192` refactor!: add a `opentelemetry_traces_operations` table to aggregate…; `ee4fe9d2` refactor: improve performance for Jaeger APIs (#5838) — run `git show` on any of them.
  • Boundary-crossing change coupling: flush.rs ↔ region.rs src/metric-engine/src/engine/flush.rs:1 — `src/metric-engine/src/engine/flush.rs` (context metric-engine) and `src/mito2/src/region.rs` (context mito2) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `28e2b5ac` feat: expose missing SST manifest fields (#8965); `a6dc55a7` feat: show sst primary key range in information_schema (#8137); `4c70b4c3` feat: store estimated series num in file meta (#7126) — run `git show` on any of them.
  • Boundary-crossing change coupling: key_column_usage.rs ↔ sql.rs src/catalog/src/system_schema/information_schema/key_column_usage.rs:1 — `src/catalog/src/system_schema/information_schema/key_column_usage.rs` (context catalog) and `src/query/src/sql.rs` (context query) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ca21c9f0` fix!: correct information_schema index metadata (#8275); `e403133e` feat: add information_schema statistics table (#8253); `8d485e9b` feat: support altering fulltext backend (#5896) — run `git show` on any of them.
  • Boundary-crossing change coupling: pipeline_operator.rs ↔ query_handler.rs src/pipeline/src/manager/pipeline_operator.rs:1 — `src/pipeline/src/manager/pipeline_operator.rs` (context pipeline) and `src/servers/src/query_handler.rs` (context servers) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `0cb70d4f` fix: tolerate invalid UTF-8 in JSON log ingestion (#10245); `7274ceba` feat: Add query pipeline http api (#5819); `f13a4364` chore: remove `Transformer` trait (#5772) — run `git show` on any of them.
  • Boundary-crossing change coupling: metasrv.rs ↔ log_store.rs src/common/wal/src/config/kafka/metasrv.rs:1 — `src/common/wal/src/config/kafka/metasrv.rs` (context common) and `src/log-store/src/kafka/log_store.rs` (context log-store) sit in DIFFERENT parts of the tree yet change together 53% of the time (9 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `fbdc35a1` ci: add remote WAL logical pruning fuzz (#8307); `2e2eacf3` feat: add SASL and TLS config for Kafka client (#4536); `a0a31c8a` chore(remote_wal): remove topic alias (#3120) (at that commit the file was still `src/common/meta/src/wal/kafka.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: copy_parser.rs ↔ requests.rs src/sql/src/parsers/copy_parser.rs:1 — `src/sql/src/parsers/copy_parser.rs` (context sql) and `src/table/src/requests.rs` (context table) sit in DIFFERENT parts of the tree yet change together 53% of the time (9 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `2ad50332` feat: impl COPY a query resultset to external file (#5250); `f93b5b19` feat: limit total rows copied in COPY TABLE FROM with LIMIT segment (…; `bba3108e` refactor!: unify sql options into OptionMap (#3792) — run `git show` on any of them.
  • Boundary-crossing change coupling: etcd.rs ↔ cluster.rs src/common/meta/src/election/etcd.rs:1 — `src/common/meta/src/election/etcd.rs` (context common) and `src/meta-srv/src/service/cluster.rs` (context meta-srv) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `c8c2e09e` refactor: move election trait and implementations to the `common-meta…; `16febbd4` feat: add CPU, memory and node status info to `cluster_info` (#6897) (at that commit the file was still `src/meta-srv/src/election/etcd.rs`); `7de62ef5` feat: add metasrv start time to node info (#3883) (at that commit the file was still `src/meta-srv/src/election/etcd.rs`) — run `git show` on any of them.
  • Boundary-crossing change coupling: key_values.rs ↔ request.rs src/mito-codec/src/key_values.rs:1 — `src/mito-codec/src/key_values.rs` (context mito-codec) and `src/mito2/src/request.rs` (context mito2) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `7341f230` feat: skip filling NULL for put and delete requests (#3364) (at that commit the file was still `src/mito2/src/memtable/key_values.rs`); `d68dd1f3` fix: schema validation is skipped once we need to fill a column (#2548) (at that commit the file was still `src/mito2/src/memtable/key_values.rs`); `21689708` feat: define region server and related requests (#2160) (at that commit the file was still `src/mito2/src/memtable/key_values.rs`) — run `git show` on any of them.
  • + 4 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AX8 · Test isolation · Production project references a test project · ×3
  • Production project references a test project: file-engine → common-test-util — `file-engine` (production) references the test project `common-test-util`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: mito2 → common-test-util — `mito2` (production) references the test project `common-test-util`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
  • Production project references a test project: puffin → common-test-util — `puffin` (production) references the test project `common-test-util`. Production must never depend on test code — it pulls a unit-test framework and test fixtures into the shipped product and inverts the only correct direction (tests depend on production, never the reverse). Move any shared helper into a production support library, or invert the reference.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge src/index/src/bitmap.rs:1 — No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
DM4 · Rich vs anemic domain model · Anemic domain model · ×1
  • Anemic domain model: DroppedTableLifecycle src/common/meta/src/key.rs:484 — `DroppedTableLifecycle` is a data-only domain entity with `pub` mutable state and no invariant-enforcing behaviour of its own, while the repo holds the logic in a foreign service/manager/use-case — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants (or make it an immutable value object with private fields) rather than being driven from outside.
Serious — 2983 finding(s)
D17 · Explicit Debt · TodoComment · ×384
  • TodoComment tests-integration/tests/http.rs:6015 — // todo(shuiyisong): refactor http error handling — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests-integration/tests/main.rs:87 — // TODO(niebayes): add integration tests for remote wal. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests-integration/src/tests/gc.rs:271 — // TODO: Add more specific assertions once we have proper file system access — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests-fuzz/src/context.rs:91 — // TODO(weny): find a better way? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests-fuzz/src/validator/column.rs:129 — // TODO: Checks `semantic_type` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests-fuzz/src/validator/column.rs:223 — // TODO(discord9): invalid prepared sql after alter — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests-fuzz/src/validator/column.rs:239 — // TODO(discord9): make sure marker value is set — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tests/runner/src/cmd/bare.rs:248 — // TODO(weny): remove postgre and mysql containers — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/metadata.rs:748 — // TODO(yingwen): Remove this. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/metadata.rs:784 — // TODO(yingwen): Tests add if not exists. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/predicate.rs:175 — // TODO(hl): `execution_props` provides variables required by evaluation. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/predicate.rs:523 — // TODO(hl): maybe we should raise an error here since cannot parse — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/stats.rs:47 — // TODO(discord9): histogram of values — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/table.rs:57 — /// TODO(discord9): add the entire partition exprs rules here later — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/table/scan.rs:77 — // TODO(ruihang): handle TimeWindowed dist via this parameter — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/predicate/stats.rs:117 — // TODO(LFC): Impl it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/table/src/predicate/stats.rs:122 — // TODO(LFC): Impl it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/mito2/src/sst/parquet/stats.rs:178 — // TODO(LFC): Impl it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/mito2/src/sst/parquet/stats.rs:183 — // TODO(LFC): Impl it. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/store-api/src/region_engine.rs:216 — /// TODO(weny): rename it to `RegionRoleState` — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/store-api/src/region_engine.rs:632 — /// TODO(weny): remove this two fields and use single instead. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/store-api/src/storage/file.rs:120 — /// TODO(discord9): change to `RemovedFile`? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/sql/src/statements.rs:88 — // TODO(dennis): supports binary — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/sql/src/statements.rs:335 — // TODO(fys): infer it later from type hints. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment src/sql/src/statements/transform/type_alias.rs:146 — // TODO(dennis): supports try_cast — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 359 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×149
  • FileTooLong: promql/planner.rs src/query/src/promql/planner.rs — FileTooLong — 4603 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 96% of them inside a single declaration: PromPlanner (2 blocks, 290-6625). The bar is 500 significant lines; this is 4103 over it, 9.21× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: statement/ddl.rs src/operator/src/statement/ddl.rs — FileTooLong — 2244 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 70% of them inside a single declaration: StatementExecutor (353-2513). The bar is 500 significant lines; this is 1744 over it, 4.49× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: functions/native_histogram.rs src/promql/src/functions/native_histogram.rs — FileTooLong — 2064 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 38 free functions. The bar is 500 significant lines; this is 1564 over it, 4.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: object_store_wal/store.rs src/log-store/src/object_store_wal/store.rs — FileTooLong — 2010 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1510 over it, 4.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/insert.rs src/operator/src/insert.rs — FileTooLong — 1882 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 68% of them inside a single declaration: Inserter (3 blocks, 113-2072). The bar is 500 significant lines; this is 1382 over it, 3.76× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: http/prometheus.rs src/servers/src/http/prometheus.rs — FileTooLong — 1871 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 52 free functions. The bar is 500 significant lines; this is 1371 over it, 3.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: otlp/trace_ingest.rs src/frontend/src/instance/otlp/trace_ingest.rs — FileTooLong — 1693 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1193 over it, 3.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/region_server.rs src/datanode/src/region_server.rs — FileTooLong — 1677 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1177 over it, 3.35× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: parquet/reader.rs src/mito2/src/sst/parquet/reader.rs — FileTooLong — 1674 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1174 over it, 3.35× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: batching_mode/task.rs src/flow/src/batching_mode/task.rs — FileTooLong — 1551 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 85% of them inside a single declaration: BatchingTask (2 blocks, 293-2291). The bar is 500 significant lines; this is 1051 over it, 3.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: read/scan_region.rs src/mito2/src/read/scan_region.rs — FileTooLong — 1512 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1012 over it, 3.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/region.rs src/mito2/src/region.rs — FileTooLong — 1491 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 991 over it, 2.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/error.rs src/mito2/src/error.rs — FileTooLong — 1466 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 98% of them inside a single declaration: Error (3 blocks, 46-1957). The bar is 500 significant lines; this is 966 over it, 2.93× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: src/region_request.rs src/store-api/src/region_request.rs — FileTooLong — 1356 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 856 over it, 2.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/worker.rs src/mito2/src/worker.rs — FileTooLong — 1354 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 854 over it, 2.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/instance.rs src/frontend/src/instance.rs — FileTooLong — 1330 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 74% of them inside a single declaration: Instance (7 blocks, 118-1606). The bar is 500 significant lines; this is 830 over it, 2.66× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: batching_mode/utils.rs src/flow/src/batching_mode/utils.rs — FileTooLong — 1288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 788 over it, 2.58× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: rpc/ddl.rs src/common/meta/src/rpc/ddl.rs — FileTooLong — 1248 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 748 over it, 2.50× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/engine.rs src/mito2/src/engine.rs — FileTooLong — 1241 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 741 over it, 2.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/key.rs src/common/meta/src/key.rs — FileTooLong — 1219 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 71% of them inside a single declaration: TableMetadataManager (2 blocks, 401-1814). The bar is 500 significant lines; this is 719 over it, 2.44× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: bulk/part.rs src/mito2/src/memtable/bulk/part.rs — FileTooLong — 1208 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 708 over it, 2.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/sql.rs src/query/src/sql.rs — FileTooLong — 1205 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 50 free functions. The bar is 500 significant lines; this is 705 over it, 2.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/ddl_manager.rs src/common/meta/src/ddl_manager.rs — FileTooLong — 1202 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 702 over it, 2.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/value.rs src/datatypes/src/value.rs — FileTooLong — 1198 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 698 over it, 2.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/cache.rs src/mito2/src/cache.rs — FileTooLong — 1179 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 679 over it, 2.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 124 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×102
  • MethodTooLong: PromPlanner.or_operator src/query/src/promql/planner/set_operator.rs:43 — MethodTooLong — or_operator runs 470 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 370 over it, 4.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PromPlanner.create_function_expr src/query/src/promql/planner.rs:3578 — MethodTooLong — create_function_expr runs 424 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 324 over it, 4.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ScanbenchCommand.run src/cmd/src/datanode/scanbench.rs:771 — MethodTooLong — run runs 422 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 322 over it, 4.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PromPlanner.prom_binary_expr_to_plan src/query/src/promql/planner.rs:1147 — MethodTooLong — prom_binary_expr_to_plan runs 403 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 303 over it, 4.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MetasrvBuilder.build src/meta-srv/src/metasrv/builder.rs:213 — MethodTooLong — build runs 382 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Inserter.create_or_alter_tables_on_demand src/operator/src/insert.rs:1284 — MethodTooLong — create_or_alter_tables_on_demand runs 297 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 197 over it, 2.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ParquetbenchCommand.run src/cmd/src/datanode/parquetbench.rs:166 — MethodTooLong — run runs 255 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Instance.metrics src/frontend/src/instance/otlp.rs:99 — MethodTooLong — metrics runs 231 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 131 over it, 2.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StartCommand.build_with src/cmd/src/standalone.rs:519 — MethodTooLong — build_with runs 224 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MergeScanExec.to_stream src/query/src/dist_plan/merge_scan.rs:617 — MethodTooLong — to_stream runs 211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ParquetReaderBuilder.build_reader_input_inner src/mito2/src/sst/parquet/reader.rs:444 — MethodTooLong — build_reader_input_inner runs 210 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 110 over it, 2.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ObjbenchCommand.run src/cmd/src/datanode/objbench.rs:70 — MethodTooLong — run runs 205 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 105 over it, 2.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Inserter.handle_bulk_insert src/operator/src/bulk_insert.rs:121 — MethodTooLong — handle_bulk_insert runs 204 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 104 over it, 2.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Inserter.validate_and_normalize_otlp_metrics src/operator/src/insert/otlp.rs:75 — MethodTooLong — validate_and_normalize_otlp_metrics runs 201 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StatementExecutor.execute_sql src/operator/src/statement.rs:248 — MethodTooLong — execute_sql runs 201 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Instance.ingest_trace_spans src/frontend/src/instance/otlp/trace_ingest.rs:1042 — MethodTooLong — ingest_trace_spans runs 198 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StatementExecutor.repartition_table src/operator/src/statement/ddl.rs:1814 — MethodTooLong — repartition_table runs 196 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 96 over it, 1.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: FrontendBuilder.try_build src/frontend/src/instance/builder.rs:194 — MethodTooLong — try_build runs 191 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 91 over it, 1.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Instance.do_query src/frontend/src/instance/grpc.rs:65 — MethodTooLong — do_query runs 187 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 87 over it, 1.87× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LocalGcWorker.do_region_gc src/mito2/src/gc.rs:436 — MethodTooLong — do_region_gc runs 183 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 83 over it, 1.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ObjectStoreLogStore.open src/log-store/src/object_store_wal/store.rs:294 — MethodTooLong — open runs 181 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Error.status_code src/mito2/src/error.rs:1641 — MethodTooLong — status_code runs 177 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 77 over it, 1.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BatchingTask.execute_plan_unlocked src/flow/src/batching_mode/task.rs:1233 — MethodTooLong — execute_plan_unlocked runs 176 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BatchingEngine.create_flow_inner src/flow/src/batching_mode/engine.rs:558 — MethodTooLong — create_flow_inner runs 175 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 75 over it, 1.75× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: HeartbeatTask.start src/datanode/src/heartbeat.rs:240 — MethodTooLong — start runs 174 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 74 over it, 1.74× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 77 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×55
  • Duplicated block (7 lines × 2) src/catalog/src/system_schema/information_schema/flows.rs:165 — src/catalog/src/system_schema/information_schema/flows.rs:165-171 | src/query/src/sql.rs:1307-1315 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/flows.rs:165` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) src/cmd/src/bin/query_regression_runner/remote/ingest.rs:297 — src/cmd/src/bin/query_regression_runner/remote/ingest.rs:297-303 | src/cmd/src/bin/query_regression_runner/remote/storage.rs:69-75 — before extracting anything, compare `src/cmd/src/bin/query_regression_runner/remote/ingest.rs` and `src/cmd/src/bin/query_regression_runner/remote/storage.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/bin/query_regression_runner/remote/ingest.rs:297` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/common/function/src/scalars/geo/h3.rs:104 — src/common/function/src/scalars/geo/h3.rs:104-110 | src/common/function/src/scalars/geo/h3.rs:829-835 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/common/function/src/scalars/ip/ipv4.rs:86 — src/common/function/src/scalars/ip/ipv4.rs:86-92 | src/common/function/src/scalars/ip/ipv6.rs:69-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/ip/ipv4.rs:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/common/function/src/scalars/json/json_to_string.rs:70 — src/common/function/src/scalars/json/json_to_string.rs:70-76 | src/common/function/src/scalars/vector/convert/vector_to_string.rs:69-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/json/json_to_string.rs:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/common/function/src/scalars/vector.rs:173 — src/common/function/src/scalars/vector.rs:173-179 | src/common/function/src/scalars/vector.rs:181-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) src/common/macro/src/admin_fn.rs:50 — src/common/macro/src/admin_fn.rs:50-56 | src/common/macro/src/range_fn.rs:39-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/macro/src/admin_fn.rs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/common/meta/src/cache/flow/table_flownode.rs:113 — src/common/meta/src/cache/flow/table_flownode.rs:113-119 | src/common/meta/src/cache/flow/table_flownode.rs:147-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/cache/flow/table_flownode.rs:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/common/meta/src/ddl/drop_table.rs:423 — src/common/meta/src/ddl/drop_table.rs:423-429 | src/common/meta/src/ddl/truncate_table.rs:97-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table.rs:423` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) REDACTED:765 — REDACTED:765-771 | REDACTED:807-813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) src/common/meta/src/key/tombstone.rs:418 — src/common/meta/src/key/tombstone.rs:418-424 | src/common/meta/src/key/tombstone.rs:470-476 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) src/common/meta/src/reconciliation/utils.rs:303 — src/common/meta/src/reconciliation/utils.rs:303-309 | src/store-api/src/region_request.rs:1050-1056 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) src/common/meta/src/reconciliation/utils.rs:310 — src/common/meta/src/reconciliation/utils.rs:310-316 | src/store-api/src/region_request.rs:1058-1065 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/reconciliation/utils.rs:310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/flow/src/batching_mode/table_creator.rs:143 — src/flow/src/batching_mode/table_creator.rs:143-149 | src/flow/src/batching_mode/table_creator.rs:158-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) src/mito2/src/engine.rs:1003 — src/mito2/src/engine.rs:1003-1009 | src/mito2/src/engine.rs:1117-1123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine.rs:1003` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/mito2/src/gc.rs:1007 — src/mito2/src/gc.rs:1007-1013 | src/mito2/src/gc.rs:1015-1021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) src/mito2/src/region/version.rs:204 — src/mito2/src/region/version.rs:204-210 | src/mito2/src/region/version.rs:244-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/region/version.rs:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/mito2/src/region/version.rs:251` calls `options` and `src/mito2/src/region/version.rs:211` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) src/mito2/src/sst/index/bloom_filter/creator.rs:201 — src/mito2/src/sst/index/bloom_filter/creator.rs:201-207 | src/mito2/src/sst/index/inverted_index/creator.rs:147-153 — `src/mito2/src/sst/index/bloom_filter/creator.rs` and `src/mito2/src/sst/index/inverted_index/creator.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/bloom_filter/creator.rs:201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/mito2/src/sst/index/fulltext_index/applier.rs:692 — src/mito2/src/sst/index/fulltext_index/applier.rs:692-698 | src/mito2/src/sst/index/fulltext_index/applier.rs:737-743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/fulltext_index/applier.rs:692` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/mito2/src/sst/parquet/prefilter.rs:121 — src/mito2/src/sst/parquet/prefilter.rs:121-127 | src/mito2/src/sst/parquet/prefilter.rs:158-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/parquet/prefilter.rs:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/promql/src/functions/native_histogram.rs:438 — src/promql/src/functions/native_histogram.rs:438-444 | src/promql/src/functions/native_histogram.rs:459-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/native_histogram.rs:438` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/query/src/log_query/planner.rs:142 — src/query/src/log_query/planner.rs:142-148 | src/query/src/log_query/planner.rs:153-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/log_query/planner.rs:142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) src/query/src/part_sort.rs:1174 — src/query/src/part_sort.rs:1174-1180 | src/query/src/part_sort.rs:1190-1196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/part_sort.rs:1174` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) src/query/src/promql/planner.rs:1354 — src/query/src/promql/planner.rs:1354-1360 | src/query/src/promql/planner.rs:1362-1368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) src/query/src/sql.rs:1039 — src/query/src/sql.rs:1039-1045 | src/query/src/sql.rs:1085-1091 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/sql.rs:1039` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 30 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×53
  • Hotspot: src/query/src/promql/planner.rs src/query/src/promql/planner.rs:3578 — src/query/src/promql/planner.rs changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 106 in PromPlanner::create_function_expr at line 3578. 19 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/query/src/promql/planner.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/operator/src/insert.rs src/operator/src/insert.rs:1284 — src/operator/src/insert.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in Inserter::create_or_alter_tables_on_demand at line 1284. 4 of those changes were fix/bug commits, and the other 23 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/operator/src/insert.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/region.rs src/mito2/src/region.rs:598 — src/mito2/src/region.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in MitoRegion::set_role_state_gracefully at line 598. 10 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/region.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/worker.rs src/mito2/src/worker.rs:1291 — src/mito2/src/worker.rs changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in RegionWorkerLoop::run at line 1291. 12 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/worker.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/sst/parquet/reader.rs src/mito2/src/sst/parquet/reader.rs:444 — src/mito2/src/sst/parquet/reader.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in ParquetReaderBuilder::build_reader_input_inner at line 444. 4 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/sst/parquet/reader.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/region/opener.rs src/mito2/src/region/opener.rs:1285 — src/mito2/src/region/opener.rs changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in mito2::region::opener::preload_parquet_meta_cache_for_files at line 1285. 9 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/region/opener.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/request.rs src/mito2/src/request.rs:856 — src/mito2/src/request.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in WorkerRequest::try_from_region_request at line 856. 9 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/request.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/log-store/src/object_store_wal/store.rs src/log-store/src/object_store_wal/store.rs:1600 — src/log-store/src/object_store_wal/store.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in Actor::run at line 1600. 6 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/log-store/src/object_store_wal/store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/cmd/src/datanode/scanbench.rs src/cmd/src/datanode/scanbench.rs:771 — src/cmd/src/datanode/scanbench.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in ScanbenchCommand::run at line 771. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/cmd/src/datanode/scanbench.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/read/seq_scan.rs src/mito2/src/read/seq_scan.rs:683 — src/mito2/src/read/seq_scan.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in mito2::read::seq_scan::build_flat_sources at line 683. 4 of those changes were fix/bug commits, and the other 8 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/read/seq_scan.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/worker/handle_manifest.rs src/mito2/src/worker/handle_manifest.rs:348 — src/mito2/src/worker/handle_manifest.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in RegionWorkerLoop::handle_region_edit at line 348. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/worker/handle_manifest.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/store-api/src/region_request.rs src/store-api/src/region_request.rs:1744 — src/store-api/src/region_request.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in SetRegionOption::try_from at line 1744. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/store-api/src/region_request.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/operator/src/statement/ddl.rs src/operator/src/statement/ddl.rs:980 — src/operator/src/statement/ddl.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in StatementExecutor::determine_flow_type at line 980. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/operator/src/statement/ddl.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/query/src/dist_plan/commutativity.rs src/query/src/dist_plan/commutativity.rs:97 — src/query/src/dist_plan/commutativity.rs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in Categorizer::check_plan at line 97. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/query/src/dist_plan/commutativity.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/operator/src/expr_helper.rs src/operator/src/expr_helper.rs:830 — src/operator/src/expr_helper.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in operator::expr_helper::to_alter_table_expr at line 830. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/operator/src/expr_helper.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/worker/handle_write.rs src/mito2/src/worker/handle_write.rs:307 — src/mito2/src/worker/handle_write.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in RegionWorkerLoop::process_write_requests at line 307. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/worker/handle_write.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/read/scan_util.rs src/mito2/src/read/scan_util.rs:1257 — src/mito2/src/read/scan_util.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in mito2::read::scan_util::should_split_flat_batches_for_merge at line 1257. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/read/scan_util.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/worker/handle_alter.rs src/mito2/src/worker/handle_alter.rs:234 — src/mito2/src/worker/handle_alter.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in RegionWorkerLoop::handle_alter_region_options_fast at line 234. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/worker/handle_alter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/query/src/dist_plan/merge_scan.rs src/query/src/dist_plan/merge_scan.rs:617 — src/query/src/dist_plan/merge_scan.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in MergeScanExec::to_stream at line 617. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/query/src/dist_plan/merge_scan.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/servers/src/otlp/metrics.rs src/servers/src/otlp/metrics.rs:1157 — src/servers/src/otlp/metrics.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in servers::otlp::metrics::encode_histogram at line 1157. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/servers/src/otlp/metrics.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/table/src/metadata.rs src/table/src/metadata.rs:358 — src/table/src/metadata.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in TableMeta::set_table_options at line 358. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/table/src/metadata.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/flow/src/batching_mode/task.rs src/flow/src/batching_mode/task.rs:1233 — src/flow/src/batching_mode/task.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in BatchingTask::execute_plan_unlocked at line 1233. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/flow/src/batching_mode/task.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/operator/src/statement.rs src/operator/src/statement.rs:567 — src/operator/src/statement.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in StatementExecutor::set_variables at line 567. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/operator/src/statement.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/frontend/src/instance/grpc.rs src/frontend/src/instance/grpc.rs:65 — src/frontend/src/instance/grpc.rs changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in Instance::do_query at line 65. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/frontend/src/instance/grpc.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: src/mito2/src/worker/handle_rebuild_index.rs src/mito2/src/worker/handle_rebuild_index.rs:167 — src/mito2/src/worker/handle_rebuild_index.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in RegionWorkerLoop::handle_rebuild_index at line 167. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/worker/handle_rebuild_index.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 28 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×53
  • ClassTooLong: PromPlanner src/query/src/promql/planner.rs:290 — ClassTooLong — 4416 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 140 methods, 2 blocks, lines 290-6625. The bar is 400 significant lines; this is 4016 over it, 11.04× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error src/mito2/src/error.rs:46 — ClassTooLong — 1437 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 3 methods, 3 blocks, lines 46-1957. The bar is 400 significant lines; this is 1037 over it, 3.59× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BatchingTask src/flow/src/batching_mode/task.rs:293 — ClassTooLong — 1324 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 2 blocks, lines 293-2291. The bar is 400 significant lines; this is 924 over it, 3.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Inserter src/operator/src/insert.rs:113 — ClassTooLong — 1282 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 42 methods, 3 blocks, lines 113-2072. The bar is 400 significant lines; this is 882 over it, 3.21× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error src/common/meta/src/error.rs:43 — ClassTooLong — 1102 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 5 methods, 3 blocks, lines 43-1507. The bar is 400 significant lines; this is 702 over it, 2.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error src/meta-srv/src/error.rs:37 — ClassTooLong — 1087 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 1 methods, 3 blocks, lines 37-1469. The bar is 400 significant lines; this is 687 over it, 2.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Instance src/frontend/src/instance.rs:118 — ClassTooLong — 984 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 106 methods, 7 blocks, lines 118-1606. The bar is 400 significant lines; this is 584 over it, 2.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ParquetReaderBuilder src/mito2/src/sst/parquet/reader.rs:190 — ClassTooLong — 910 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 33 methods, 2 blocks, lines 190-1496. The bar is 400 significant lines; this is 510 over it, 2.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error src/operator/src/error.rs:34 — ClassTooLong — 886 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 2 blocks, lines 34-1204. The bar is 400 significant lines; this is 486 over it, 2.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TableMeta src/table/src/metadata.rs:138 — ClassTooLong — 873 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 23 methods, 4 blocks, lines 138-1433. The bar is 400 significant lines; this is 473 over it, 2.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TableMetadataManager src/common/meta/src/key.rs:401 — ClassTooLong — 863 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 49 methods, 2 blocks, lines 401-1814. The bar is 400 significant lines; this is 463 over it, 2.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Actor src/log-store/src/object_store_wal/store.rs:1516 — ClassTooLong — 847 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 42 methods, 3 blocks, lines 1516-2904. The bar is 400 significant lines; this is 447 over it, 2.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error src/pipeline/src/error.rs:27 — ClassTooLong — 810 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 2 blocks, lines 27-1047. The bar is 400 significant lines; this is 410 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RegionServer src/datanode/src/region_server.rs:115 — ClassTooLong — 732 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 50 methods, 5 blocks, lines 115-1245. The bar is 400 significant lines; this is 332 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Error src/servers/src/error.rs:40 — ClassTooLong — 656 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 0 methods, 4 blocks, lines 40-952. The bar is 400 significant lines; this is 256 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BatchingEngine src/flow/src/batching_mode/engine.rs:67 — ClassTooLong — 646 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 15 methods, 5 blocks, lines 67-1096. The bar is 400 significant lines; this is 246 over it, 1.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LocalGcWorker src/mito2/src/gc.rs:215 — ClassTooLong — 646 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 3 blocks, lines 215-1219. The bar is 400 significant lines; this is 246 over it, 1.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ObjectStoreLogStore src/log-store/src/object_store_wal/store.rs:128 — ClassTooLong — 643 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 11 methods, 5 blocks, lines 128-1266. The bar is 400 significant lines; this is 243 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MitoRegion src/mito2/src/region.rs:168 — ClassTooLong — 632 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 58 methods, 3 blocks, lines 168-1309. The bar is 400 significant lines; this is 232 over it, 1.58× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BatchGcProcedure src/meta-srv/src/gc/procedure.rs:219 — ClassTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 3 blocks, lines 219-1155. The bar is 400 significant lines; this is 222 over it, 1.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DdlManager src/common/meta/src/ddl_manager.rs:111 — ClassTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 31 methods, 2 blocks, lines 111-1116. The bar is 400 significant lines; this is 214 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MitoEngine src/mito2/src/engine.rs:298 — ClassTooLong — 607 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 40 methods, 5 blocks, lines 298-1870. The bar is 400 significant lines; this is 207 over it, 1.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: RegionServerInner src/datanode/src/region_server.rs:1381 — ClassTooLong — 588 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 2 blocks, lines 1381-2315. The bar is 400 significant lines; this is 188 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Value src/datatypes/src/value.rs:52 — ClassTooLong — 541 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 20 methods, 12 blocks, lines 52-1314. The bar is 400 significant lines; this is 141 over it, 1.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MysqlInstanceShim src/servers/src/mysql/handler.rs:80 — ClassTooLong — 538 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 13 methods, 3 blocks, lines 80-829. The bar is 400 significant lines; this is 138 over it, 1.35× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 28 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×51
  • Duplicated block (11 lines × 2) src/catalog/src/memory/manager.rs:325 — src/catalog/src/memory/manager.rs:325-335 | src/catalog/src/memory/manager.rs:368-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `DeregisterTableRequest` in one and `RegisterTableRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) src/catalog/src/system_schema/information_schema/region_info.rs:71 — src/catalog/src/system_schema/information_schema/region_info.rs:71-81 | src/catalog/src/system_schema/information_schema/region_info.rs:97-107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) src/cmd/src/flownode.rs:307 — src/cmd/src/flownode.rs:307-317 | tests-integration/src/cluster.rs:611-621 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/flownode.rs:307` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/cmd/src/frontend.rs:346 — src/cmd/src/frontend.rs:346-356 | src/cmd/src/standalone.rs:467-477 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `opts` to `&mut FrontendOptions` in one and `&mut StandaloneOptions` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) src/common/function/src/scalars/string/locate.rs:147 — src/common/function/src/scalars/string/locate.rs:147-157 | src/common/function/src/scalars/string/regexp_extract.rs:146-156 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/string/locate.rs:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/common/function/src/scalars/string/locate.rs:145` calls `with_capacity` and `src/common/function/src/scalars/string/regexp_extract.rs:144` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) src/common/meta/src/cache/container.rs:203 — src/common/meta/src/cache/container.rs:203-213 | src/common/meta/src/cache/container.rs:276-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `caches` to `&[CacheIdent]` in one and `&[CacheToken]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) src/common/meta/src/ddl/drop_table/executor.rs:420 — src/common/meta/src/ddl/drop_table/executor.rs:420-430 | src/common/meta/src/ddl/undrop_table.rs:525-535 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table/executor.rs:420` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) REDACTED:636 — REDACTED:636-646 | REDACTED:436-446 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:636` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:649` calls `maybe_init_client` and `REDACTED:461` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) src/common/meta/src/kv_backend/rds/mysql.rs:85 — src/common/meta/src/kv_backend/rds/mysql.rs:85-95 | src/common/meta/src/kv_backend/rds/postgres.rs:117-127 — before extracting anything, compare `src/common/meta/src/kv_backend/rds/mysql.rs` and `src/common/meta/src/kv_backend/rds/postgres.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) src/common/time/src/range.rs:51 — src/common/time/src/range.rs:51-61 | src/common/time/src/range.rs:92-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/time/src/range.rs:51` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) src/datatypes/src/vectors/string.rs:401 — src/datatypes/src/vectors/string.rs:401-411 | src/datatypes/src/vectors/string.rs:441-451 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/datatypes/src/vectors/string.rs:401` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/file-engine/src/manifest.rs:92 — src/file-engine/src/manifest.rs:92-102 | src/relational-engine/src/manifest.rs:102-112 — before extracting anything, compare `src/file-engine/src/manifest.rs` and `src/relational-engine/src/manifest.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) src/frontend/src/instance.rs:331 — src/frontend/src/instance.rs:331-341 | src/frontend/src/instance.rs:924-934 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance.rs:331` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/frontend/src/service_config/pending_rows_batcher.rs:66 — src/frontend/src/service_config/pending_rows_batcher.rs:66-76 | src/frontend/src/service_config/prom_store.rs:70-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/service_config/pending_rows_batcher.rs:66` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/meta-client/src/client/cluster.rs:194 — src/meta-client/src/client/cluster.rs:194-204 | src/meta-client/src/client/procedure.rs:228-238 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-client/src/client/cluster.rs:194` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (11 lines × 2) src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:221 — src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:221-231 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:202-212 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` and `src/meta-srv/src/procedure/repartition/group/sync_region.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/metric-engine/src/engine.rs:251 — src/metric-engine/src/engine.rs:251-261 | src/metric-engine/src/engine.rs:264-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) src/mito2/src/manifest/manager.rs:233 — src/mito2/src/manifest/manager.rs:233-243 | src/mito2/src/manifest/manager.rs:323-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) src/mito2/src/request.rs:868 — src/mito2/src/request.rs:868-878 | src/mito2/src/request.rs:883-893 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/request.rs:868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/mito2/src/request.rs:867` calls `with_skip_wal` and `src/mito2/src/request.rs:882` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) src/mito2/src/series_index/writer.rs:216 — src/mito2/src/series_index/writer.rs:216-226 | src/mito2/src/sst/range_index/writer.rs:209-219 — before extracting anything, compare `src/mito2/src/series_index/writer.rs` and `src/mito2/src/sst/range_index/writer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/series_index/writer.rs:216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/mito2/src/sst/index/bloom_filter/creator.rs:250 — src/mito2/src/sst/index/bloom_filter/creator.rs:250-260 | src/mito2/src/sst/index/inverted_index/creator.rs:284-294 — `src/mito2/src/sst/index/bloom_filter/creator.rs` and `src/mito2/src/sst/index/inverted_index/creator.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/bloom_filter/creator.rs:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/mito2/src/sst/index/fulltext_index/applier.rs:727 — src/mito2/src/sst/index/fulltext_index/applier.rs:727-737 | src/mito2/src/sst/index/fulltext_index/applier.rs:744-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/fulltext_index/applier.rs:727` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:227 — src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:227-237 | src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:429-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:227` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/promql/src/extension_plan/instant_manipulate.rs:187 — src/promql/src/extension_plan/instant_manipulate.rs:187-197 | src/promql/src/extension_plan/normalize.rs:140-150 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/normalize.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/instant_manipulate.rs:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) src/promql/src/extension_plan/instant_manipulate.rs:656 — src/promql/src/extension_plan/instant_manipulate.rs:656-666 | src/promql/src/extension_plan/normalize.rs:500-510 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/normalize.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/instant_manipulate.rs:656` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 26 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×49
  • Duplicated block (9 lines × 2) src/api/src/v1/column_def.rs:288 — src/api/src/v1/column_def.rs:288-296 | src/operator/src/expr_helper.rs:962-970 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) src/cli/src/data/export_v2/command.rs:398 — src/cli/src/data/export_v2/command.rs:398-406 | src/cli/src/data/import_v2/command.rs:131-139 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/cli/src/data/import_v2/command.rs:126` calls `from_uri`, `context`, `map_err` and `src/cli/src/data/export_v2/command.rs:395` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) src/cmd/src/datanode/parquetbench.rs:309 — src/cmd/src/datanode/parquetbench.rs:309-317 | src/cmd/src/datanode/scanbench.rs:919-927 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/datanode/parquetbench.rs:309` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/cmd/src/datanode/scanbench.rs:922 — src/cmd/src/datanode/scanbench.rs:922-931 | src/cmd/src/datanode/scanbench.rs:1224-1232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/datanode/scanbench.rs:922` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/common/function/src/scalars/geo/geohash.rs:95 — src/common/function/src/scalars/geo/geohash.rs:95-103 | src/common/function/src/scalars/geo/h3.rs:194-202 — before extracting anything, compare `src/common/function/src/scalars/geo/geohash.rs` and `src/common/function/src/scalars/geo/h3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/geohash.rs:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/common/function/src/scalars/ip/cidr.rs:82 — src/common/function/src/scalars/ip/cidr.rs:82-90 | src/common/function/src/scalars/ip/cidr.rs:220-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/common/meta/src/ddl/drop_table/executor.rs:432 — src/common/meta/src/ddl/drop_table/executor.rs:432-440 | src/common/meta/src/ddl/undrop_table.rs:537-545 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table/executor.rs:432` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) src/common/meta/src/key.rs:1626 — src/common/meta/src/key.rs:1626-1634 | src/common/meta/src/key.rs:1795-1803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:1626` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/common/meta/src/key/tombstone.rs:446 — src/common/meta/src/key/tombstone.rs:446-454 | src/common/meta/src/key/tombstone.rs:506-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/common/meta/src/state_store.rs:299 — src/common/meta/src/state_store.rs:299-307 | src/common/meta/src/state_store.rs:332-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/state_store.rs:299` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 2) src/flow/src/batching_mode/task.rs:941 — src/flow/src/batching_mode/task.rs:941-949 | src/flow/src/batching_mode/task.rs:1079-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/task.rs:941` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) src/meta-srv/src/procedure/repartition.rs:926 — src/meta-srv/src/procedure/repartition.rs:926-934 | src/meta-srv/src/procedure/repartition.rs:944-952 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/meta-srv/src/selector/lease_based.rs:35 — src/meta-srv/src/selector/lease_based.rs:35-43 | src/meta-srv/src/selector/load_based.rs:54-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) src/metric-engine/src/batch_modifier.rs:71 — src/metric-engine/src/batch_modifier.rs:71-79 | src/metric-engine/src/batch_modifier.rs:90-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) src/mito-codec/src/key_values.rs:149 — src/mito-codec/src/key_values.rs:149-157 | src/mito-codec/src/key_values.rs:162-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito-codec/src/key_values.rs:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/mito2/src/memtable/bulk/part.rs:190 — src/mito2/src/memtable/bulk/part.rs:190-198 | src/mito2/src/memtable/bulk/part.rs:1933-1941 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/memtable/bulk/part.rs:190` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/mito2/src/memtable/simple_bulk_memtable.rs:78 — src/mito2/src/memtable/simple_bulk_memtable.rs:78-86 | src/mito2/src/memtable/time_series.rs:244-252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) src/mito2/src/read/compat.rs:436 — src/mito2/src/read/compat.rs:436-444 | src/mito2/src/read/compat.rs:597-605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/compat.rs:436` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/mito2/src/read/range_cache.rs:204 — src/mito2/src/read/range_cache.rs:204-212 | src/mito2/src/read/range_cache.rs:219-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/range_cache.rs:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/mito2/src/read/scan_util.rs:1491 — src/mito2/src/read/scan_util.rs:1491-1499 | src/mito2/src/read/series_reader.rs:442-450 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) src/mito2/src/sst/index/bloom_filter/applier.rs:237 — src/mito2/src/sst/index/bloom_filter/applier.rs:237-245 | src/mito2/src/sst/index/fulltext_index/applier.rs:534-542 — `src/mito2/src/sst/index/bloom_filter/applier.rs` and `src/mito2/src/sst/index/fulltext_index/applier.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 40 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) src/mito2/src/sst/index/bloom_filter/applier/builder.rs:181 — src/mito2/src/sst/index/bloom_filter/applier/builder.rs:181-189 | src/mito2/src/sst/index/bloom_filter/applier/builder.rs:253-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) src/mito2/src/sst/index/bloom_filter/creator.rs:289 — src/mito2/src/sst/index/bloom_filter/creator.rs:289-297 | src/mito2/src/sst/index/inverted_index/creator.rs:321-329 — `src/mito2/src/sst/index/bloom_filter/creator.rs` and `src/mito2/src/sst/index/inverted_index/creator.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/bloom_filter/creator.rs:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/query/src/part_sort.rs:1037 — src/query/src/part_sort.rs:1037-1045 | src/query/src/part_sort.rs:1100-1108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/part_sort.rs:1037` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) src/servers/src/batcher/logical_table/tables.rs:304 — src/servers/src/batcher/logical_table/tables.rs:304-312 | src/servers/src/batcher/logical_table/tables.rs:405-413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/batcher/logical_table/tables.rs:304` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/servers/src/batcher/logical_table/tables.rs:314` calls `enqueue_alter_for_new_tables` and `src/servers/src/batcher/logical_table/tables.rs:415` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • + 24 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×48
  • Duplicated block (10 lines × 2) src/cli/src/data/export_v2/command.rs:531 — src/cli/src/data/export_v2/command.rs:531-540 | src/cli/src/data/export_v2/command.rs:608-617 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/src/data/export_v2/command.rs:531` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/common/function/src/scalars/geo/geohash.rs:111 — src/common/function/src/scalars/geo/geohash.rs:111-120 | src/common/function/src/scalars/geo/geohash.rs:212-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/geohash.rs:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/common/function/src/scalars/geo/h3.rs:900 — src/common/function/src/scalars/geo/h3.rs:900-909 | src/common/function/src/scalars/geo/h3.rs:959-968 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:900` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/common/function/src/scalars/vector.rs:128 — src/common/function/src/scalars/vector.rs:128-137 | src/common/function/src/scalars/vector.rs:160-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/vector.rs:128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/common/function/src/scalars/vector/scalar_add.rs:97 — src/common/function/src/scalars/vector/scalar_add.rs:97-106 | src/common/function/src/scalars/vector/scalar_mul.rs:97-106 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/vector/scalar_add.rs:97` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/common/macro/src/range_fn.rs:78 — src/common/macro/src/range_fn.rs:78-87 | src/common/macro/src/range_fn.rs:195-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/common/meta/src/ddl/alter_logical_tables/executor.rs:59 — src/common/meta/src/ddl/alter_logical_tables/executor.rs:59-68 | src/common/meta/src/reconciliation/reconcile_logical_tables/reconcile_regions.rs:57-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/alter_logical_tables/executor.rs:59` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) src/common/meta/src/ddl/drop_table/executor.rs:451 — src/common/meta/src/ddl/drop_table/executor.rs:451-460 | src/common/meta/src/ddl/drop_table/executor.rs:530-539 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table/executor.rs:451` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/common/meta/src/key.rs:964 — src/common/meta/src/key.rs:964-975 | src/common/meta/src/key.rs:1680-1689 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:964` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/common/runtime/src/runtime.rs:165 — src/common/runtime/src/runtime.rs:165-174 | src/common/runtime/src/runtime.rs:199-208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/flow/src/adapter/util.rs:177 — src/flow/src/adapter/util.rs:177-186 | src/operator/src/expr_helper.rs:679-689 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/adapter/util.rs:177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/flow/src/batching_mode/engine.rs:199 — src/flow/src/batching_mode/engine.rs:199-208 | src/flow/src/batching_mode/engine.rs:337-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/flow/src/batching_mode/engine.rs:211 — src/flow/src/batching_mode/engine.rs:211-220 | src/flow/src/batching_mode/engine.rs:360-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/flow/src/batching_mode/state.rs:606 — src/flow/src/batching_mode/state.rs:606-615 | src/flow/src/batching_mode/state.rs:754-763 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/frontend/src/instance/otlp/trace_ingest.rs:653 — src/frontend/src/instance/otlp/trace_ingest.rs:653-663 | src/frontend/src/instance/otlp/trace_ingest.rs:1893-1902 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/otlp/trace_ingest.rs:653` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) src/index/src/inverted_index/create/sort/intermediate_rw/codec_v1.rs:77 — src/index/src/inverted_index/create/sort/intermediate_rw/codec_v1.rs:77-86 | src/index/src/inverted_index/create/sort/intermediate_rw/codec_v1.rs:90-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:225 — src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:225-234 | src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs:253-262 — before extracting anything, compare `src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs` and `src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:225` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/mito2/src/cache/index/bloom_filter_index.rs:189 — src/mito2/src/cache/index/bloom_filter_index.rs:189-198 | src/mito2/src/cache/index/inverted_index.rs:165-174 — before extracting anything, compare `src/mito2/src/cache/index/bloom_filter_index.rs` and `src/mito2/src/cache/index/inverted_index.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) src/mito2/src/engine/table_compaction/output.rs:128 — src/mito2/src/engine/table_compaction/output.rs:128-138 | src/mito2/src/sst/parquet/writer.rs:457-466 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine/table_compaction/output.rs:128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/mito2/src/memtable/simple_bulk_memtable.rs:109 — src/mito2/src/memtable/simple_bulk_memtable.rs:109-118 | src/mito2/src/memtable/time_series.rs:287-297 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) src/mito2/src/memtable/time_series.rs:1192 — src/mito2/src/memtable/time_series.rs:1192-1201 | src/mito2/src/memtable/time_series.rs:1334-1343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/memtable/time_series.rs:1192` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) src/mito2/src/read/seq_scan.rs:90 — src/mito2/src/read/seq_scan.rs:90-99 | src/mito2/src/read/series_scan.rs:149-158 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/series_scan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/seq_scan.rs:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/operator/src/insert.rs:1343 — src/operator/src/insert.rs:1343-1352 | src/operator/src/insert.rs:1374-1383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) src/pipeline/src/etl/processor/digest.rs:150 — src/pipeline/src/etl/processor/digest.rs:150-159 | src/pipeline/src/etl/processor/digest.rs:165-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/digest.rs:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) src/promql/src/extension_plan/instant_manipulate.rs:523 — src/promql/src/extension_plan/instant_manipulate.rs:523-532 | src/promql/src/extension_plan/range_manipulate.rs:531-540 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/range_manipulate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/instant_manipulate.rs:523` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 23 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×43
  • FunctionTooLong: servers::postgres::types::parameters_to_scalar_values src/servers/src/postgres/types.rs:574 — FunctionTooLong — servers::postgres::types::parameters_to_scalar_values runs 606 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 506 over it, 6.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: catalog::system_schema::information_schema::information_memory_table::get_schema_columns src/catalog/src/system_schema/information_schema/information_memory_table.rs:30 — FunctionTooLong — catalog::system_schema::information_schema::information_memory_table::get_schema_columns runs 311 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 211 over it, 3.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::prom_remote_write::v2::convert_remote_write_v2 src/servers/src/prom_remote_write/v2.rs:314 — FunctionTooLong — servers::prom_remote_write::v2::convert_remote_write_v2 runs 221 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 121 over it, 2.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: flow::batching_mode::utils::rewrite_incremental_aggregate_with_sink_merge src/flow/src/batching_mode/utils.rs:631 — FunctionTooLong — flow::batching_mode::utils::rewrite_incremental_aggregate_with_sink_merge runs 200 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 100 over it, 2.00× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::http::jaeger::traces_from_records src/servers/src/http/jaeger.rs:769 — FunctionTooLong — servers::http::jaeger::traces_from_records runs 189 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 89 over it, 1.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: operator::expr_helper::to_alter_table_expr src/operator/src/expr_helper.rs:830 — FunctionTooLong — operator::expr_helper::to_alter_table_expr runs 162 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 62 over it, 1.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: common_query::native_histogram::encoding::decode_native_histogram_for_remote_read src/common/query/src/native_histogram/encoding.rs:151 — FunctionTooLong — common_query::native_histogram::encoding::decode_native_histogram_for_remote_read runs 156 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: common_grpc_expr::alter::alter_expr_to_request src/common/grpc-expr/src/alter.rs:184 — FunctionTooLong — common_grpc_expr::alter::alter_expr_to_request runs 150 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: mito2::memtable::bulk::part::convert_bulk_part src/mito2/src/memtable/bulk/part.rs:1045 — FunctionTooLong — mito2::memtable::bulk::part::convert_bulk_part runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: promql::functions::native_histogram::native_extrapolated_rate src/promql/src/functions/native_histogram.rs:2467 — FunctionTooLong — promql::functions::native_histogram::native_extrapolated_rate runs 146 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::otlp::metrics::encode_histogram src/servers/src/otlp/metrics.rs:1157 — FunctionTooLong — servers::otlp::metrics::encode_histogram runs 146 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::http::handler::sql_analyze_stream src/servers/src/http/handler.rs:384 — FunctionTooLong — servers::http::handler::sql_analyze_stream runs 142 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::prom_remote_write::v2::decode_series_leaves src/servers/src/prom_remote_write/v2.rs:724 — FunctionTooLong — servers::prom_remote_write::v2::decode_series_leaves runs 140 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::postgres::handler::describe_fields src/servers/src/postgres/handler.rs:659 — FunctionTooLong — servers::postgres::handler::describe_fields runs 135 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: common_macro::admin_fn::build_struct src/common/macro/src/admin_fn.rs:156 — FunctionTooLong — common_macro::admin_fn::build_struct runs 133 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::http::prometheus::label_values_query src/servers/src/http/prometheus.rs:1852 — FunctionTooLong — servers::http::prometheus::label_values_query runs 133 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: operator::statement::semantic_graph::relationships::calls_branch src/operator/src/statement/semantic_graph/relationships.rs:337 — FunctionTooLong — operator::statement::semantic_graph::relationships::calls_branch runs 130 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 30 over it, 1.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: common_query::native_histogram::build_histogram_array src/common/query/src/native_histogram.rs:1534 — FunctionTooLong — common_query::native_histogram::build_histogram_array runs 129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: meta_srv::bootstrap::metasrv_builder src/meta-srv/src/bootstrap.rs:286 — FunctionTooLong — meta_srv::bootstrap::metasrv_builder runs 126 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: datanode::utils::build_region_open_requests src/datanode/src/utils.rs:118 — FunctionTooLong — datanode::utils::build_region_open_requests runs 124 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: cmd::bin::query_regression_runner::remote::read_bench::run_read_bench src/cmd/src/bin/query_regression_runner/remote/read_bench.rs:36 — FunctionTooLong — cmd::bin::query_regression_runner::remote::read_bench::run_read_bench runs 122 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: promql::functions::native_histogram::mixed_range src/promql/src/functions/native_histogram.rs:1735 — FunctionTooLong — promql::functions::native_histogram::mixed_range runs 122 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: servers::pipeline::run_custom_pipeline src/servers/src/pipeline.rs:99 — FunctionTooLong — servers::pipeline::run_custom_pipeline runs 119 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: common_telemetry::logging::init_global_logging src/common/telemetry/src/logging.rs:495 — FunctionTooLong — common_telemetry::logging::init_global_logging runs 118 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: operator::statement::copy_table_to::stream_to_managed_parquet_with_packed src/operator/src/statement/copy_table_to.rs:262 — FunctionTooLong — operator::statement::copy_table_to::stream_to_managed_parquet_with_packed runs 116 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 18 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×43
  • Duplicated block (8 lines × 2) src/catalog/src/system_schema/information_schema/partitions.rs:311 — src/catalog/src/system_schema/information_schema/partitions.rs:311-318 | src/catalog/src/system_schema/information_schema/region_peers.rs:203-210 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/partitions.rs:311` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/common/function/src/aggrs/approximate/uddsketch.rs:72 — src/common/function/src/aggrs/approximate/uddsketch.rs:72-79 | src/common/function/src/aggrs/approximate/uddsketch.rs:92-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/approximate/uddsketch.rs:72` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/common/function/src/scalars/ip/cidr.rs:92 — src/common/function/src/scalars/ip/cidr.rs:92-99 | src/common/function/src/scalars/ip/cidr.rs:231-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) src/common/macro/src/row/schema.rs:130 — src/common/macro/src/row/schema.rs:130-137 | src/common/macro/src/row/schema.rs:171-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/macro/src/row/schema.rs:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/common/query/src/request.rs:242 — src/common/query/src/request.rs:242-249 | src/common/query/src/request.rs:706-713 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/query/src/request.rs:242` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/datatypes/src/vectors/binary.rs:428 — src/datatypes/src/vectors/binary.rs:428-435 | src/datatypes/src/vectors/decimal.rs:232-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) src/frontend/src/instance.rs:591 — src/frontend/src/instance.rs:591-598 | src/frontend/src/instance.rs:1223-1230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance.rs:591` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) src/frontend/src/instance/otlp/trace_ingest.rs:707 — src/frontend/src/instance/otlp/trace_ingest.rs:707-714 | src/frontend/src/instance/otlp/trace_ingest.rs:2307-2314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/otlp/trace_ingest.rs:707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/log-store/src/object_store_wal/store.rs:1674 — src/log-store/src/object_store_wal/store.rs:1674-1681 | src/log-store/src/object_store_wal/store.rs:2585-2592 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) src/meta-srv/src/cluster.rs:240 — src/meta-srv/src/cluster.rs:240-247 | src/meta-srv/src/cluster.rs:269-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) src/meta-srv/src/metasrv.rs:835 — src/meta-srv/src/metasrv.rs:835-842 | src/standalone/src/information_extension.rs:83-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:234 — src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:234-241 | src/meta-srv/src/procedure/region_migration/open_candidate_region.rs:180-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:234` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/mito2/src/compaction/compactor.rs:706 — src/mito2/src/compaction/compactor.rs:706-714 | src/mito2/src/flush.rs:836-843 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/compaction/compactor.rs:706` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/mito2/src/memtable/bulk.rs:648 — src/mito2/src/memtable/bulk.rs:648-655 | src/mito2/src/memtable/time_series.rs:430-437 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/memtable/bulk.rs:648` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/mito2/src/worker/handle_write.rs:661 — src/mito2/src/worker/handle_write.rs:661-668 | src/mito2/src/worker/handle_write.rs:765-772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) src/partition/src/simplify.rs:249 — src/partition/src/simplify.rs:249-256 | src/partition/src/simplify.rs:266-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) src/promql/src/extension_plan/instant_manipulate.rs:411 — src/promql/src/extension_plan/instant_manipulate.rs:411-418 | src/promql/src/extension_plan/range_manipulate.rs:237-244 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/range_manipulate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/instant_manipulate.rs:411` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/sql/src/parsers/alter_parser.rs:209 — src/sql/src/parsers/alter_parser.rs:209-216 | src/sql/src/parsers/alter_parser.rs:259-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/alter_parser.rs:209` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/common/meta/src/ddl/alter_table/partition_compat.rs:255 — src/common/meta/src/ddl/alter_table/partition_compat.rs:255-262 | src/datatypes/src/value.rs:491-498 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) src/common/function/src/scalars/geo/h3.rs:1350 — src/common/function/src/scalars/geo/h3.rs:1350-1357 | src/common/function/src/scalars/geo/s2.rs:269-276 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) src/common/function/src/system/database.rs:58 — src/common/function/src/system/database.rs:58-65 | src/common/function/src/system/pg_catalog.rs:89-96 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/system/database.rs:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/common/function/src/system/database.rs:92 — src/common/function/src/system/database.rs:92-99 | src/common/function/src/system/pg_catalog.rs:115-122 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/system/database.rs:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) src/datatypes/src/vectors/list.rs:312 — src/datatypes/src/vectors/list.rs:312-319 | src/datatypes/src/vectors/struct_vector.rs:375-382 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) src/file-engine/src/engine.rs:108 — src/file-engine/src/engine.rs:108-115 | src/relational-engine/src/engine.rs:85-92 — before extracting anything, compare `src/file-engine/src/engine.rs` and `src/relational-engine/src/engine.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) src/common/meta/src/ddl/create_database.rs:272 — src/common/meta/src/ddl/create_database.rs:272-279 | src/common/meta/src/ddl/drop_database.rs:168-175 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 18 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×40
  • Duplicated block (12 lines × 2) src/cli/src/data/export.rs:170 — src/cli/src/data/export.rs:170-181 | src/cli/src/data/import.rs:100-111 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) src/common/function/src/admin/reconcile_catalog.rs:58 — src/common/function/src/admin/reconcile_catalog.rs:58-69 | src/common/function/src/admin/reconcile_database.rs:65-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/admin/reconcile_catalog.rs:58` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/common/function/src/admin/reconcile_database.rs:77` calls `get_string_from_params` and `src/common/function/src/admin/reconcile_catalog.rs:70` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) src/common/meta/src/ddl/drop_table/executor.rs:295 — src/common/meta/src/ddl/drop_table/executor.rs:295-306 | src/common/meta/src/ddl/drop_table/executor.rs:407-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table/executor.rs:295` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/file-engine/src/engine.rs:303 — src/file-engine/src/engine.rs:303-314 | src/relational-engine/src/engine.rs:304-315 — before extracting anything, compare `src/file-engine/src/engine.rs` and `src/relational-engine/src/engine.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/file-engine/src/engine.rs:303` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/file-engine/src/engine.rs:300` calls `ensure_region_requirements` and `src/relational-engine/src/engine.rs:301` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) src/file-engine/src/engine.rs:336 — src/file-engine/src/engine.rs:336-347 | src/relational-engine/src/engine.rs:337-348 — before extracting anything, compare `src/file-engine/src/engine.rs` and `src/relational-engine/src/engine.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/file-engine/src/engine.rs:336` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/flow/src/adapter/flownode_impl.rs:308 — src/flow/src/adapter/flownode_impl.rs:308-319 | src/flow/src/server.rs:480-491 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/adapter/flownode_impl.rs:308` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/index/src/fulltext_index/create/bloom_filter.rs:111 — src/index/src/fulltext_index/create/bloom_filter.rs:111-122 | src/mito2/src/sst/index/bloom_filter/creator.rs:491-502 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/index/src/fulltext_index/create/bloom_filter.rs:111` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:212 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:212-223 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:201-212 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:212` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) src/mito2/src/config.rs:769 — src/mito2/src/config.rs:769-780 | src/mito2/src/config.rs:856-867 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) src/mito2/src/engine.rs:956 — src/mito2/src/engine.rs:956-967 | src/mito2/src/engine.rs:1052-1063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine.rs:956` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `region_requests` to `Vec<(RegionId, RegionOpenRequest)>` in one and `Vec<(RegionId, RegionCatchupRequest)>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/mito2/src/engine.rs:955` calls `kafka_provider` and `src/mito2/src/engine.rs:1051` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) src/mito2/src/engine.rs:1029 — src/mito2/src/engine.rs:1029-1040 | src/mito2/src/engine.rs:1145-1156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine.rs:1029` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/mito2/src/region/opener.rs:396 — src/mito2/src/region/opener.rs:396-407 | src/mito2/src/region/opener.rs:535-546 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/region/opener.rs:396` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) src/mito2/src/series_index/writer.rs:418 — src/mito2/src/series_index/writer.rs:418-429 | src/mito2/src/sst/range_index/writer.rs:441-452 — before extracting anything, compare `src/mito2/src/series_index/writer.rs` and `src/mito2/src/sst/range_index/writer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) src/mito2/src/sst/index/bloom_filter/creator.rs:206 — src/mito2/src/sst/index/bloom_filter/creator.rs:206-217 | src/mito2/src/sst/index/bloom_filter/creator.rs:229-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/bloom_filter/creator.rs:206` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/mito2/src/sst/index/fulltext_index/applier.rs:315 — src/mito2/src/sst/index/fulltext_index/applier.rs:315-326 | src/mito2/src/sst/index/fulltext_index/applier.rs:376-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/fulltext_index/applier.rs:315` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/mito2/src/sst/index/fulltext_index/creator.rs:238 — src/mito2/src/sst/index/fulltext_index/creator.rs:238-249 | src/mito2/src/sst/index/fulltext_index/creator.rs:260-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/fulltext_index/creator.rs:238` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/mito2/src/sst/index/handler/builtin/bloom.rs:50 — src/mito2/src/sst/index/handler/builtin/bloom.rs:50-61 | src/mito2/src/sst/index/handler/builtin/fulltext.rs:51-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/handler/builtin/bloom.rs:50` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:303 — src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:303-314 | src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:363-374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `n` to `i64` in one and `u64` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:301` calls `I64Value` and `src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:361` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) src/promql/src/extension_plan/scalar_calculate.rs:450 — src/promql/src/extension_plan/scalar_calculate.rs:450-461 | src/promql/src/extension_plan/series_divide.rs:438-449 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) src/promql/src/functions/quantile.rs:115 — src/promql/src/functions/quantile.rs:115-126 | src/promql/src/functions/quantile.rs:162-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/quantile.rs:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/query/src/datafusion.rs:584 — src/query/src/datafusion.rs:584-596 | src/query/src/planner.rs:121-132 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) src/query/src/part_sort.rs:638 — src/query/src/part_sort.rs:638-649 | src/query/src/part_sort.rs:885-896 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/part_sort.rs:638` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/query/src/promql/planner.rs:3928 — src/query/src/promql/planner.rs:3928-3939 | src/query/src/promql/planner.rs:3949-3960 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) src/servers/src/grpc.rs:158 — src/servers/src/grpc.rs:158-169 | src/servers/src/grpc.rs:181-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/grpc.rs:158` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) src/servers/src/http/prometheus.rs:857 — src/servers/src/http/prometheus.rs:857-868 | src/servers/src/http/prometheus.rs:2538-2549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×36
  • Duplicated block (13 lines × 2) src/catalog/src/system_schema/information_schema/table_semantics.rs:260 — src/catalog/src/system_schema/information_schema/table_semantics.rs:260-272 | src/catalog/src/system_schema/information_schema/tables.rs:164-176 — before extracting anything, compare `src/catalog/src/system_schema/information_schema/table_semantics.rs` and `src/catalog/src/system_schema/information_schema/tables.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/table_semantics.rs:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/catalog/src/system_schema/information_schema/table_semantics.rs:428 — src/catalog/src/system_schema/information_schema/table_semantics.rs:428-440 | src/catalog/src/system_schema/information_schema/tables.rs:465-477 — before extracting anything, compare `src/catalog/src/system_schema/information_schema/table_semantics.rs` and `src/catalog/src/system_schema/information_schema/tables.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) src/common/datasource/src/file_format/csv.rs:78 — src/common/datasource/src/file_format/csv.rs:78-90 | src/common/datasource/src/file_format/json.rs:56-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/datasource/src/file_format/csv.rs:78` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/common/function/src/aggrs/vector/product.rs:153 — src/common/function/src/aggrs/vector/product.rs:153-165 | src/common/function/src/aggrs/vector/sum.rs:152-164 — before extracting anything, compare `src/common/function/src/aggrs/vector/product.rs` and `src/common/function/src/aggrs/vector/sum.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/vector/product.rs:153` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) src/common/meta/src/cache/container.rs:254 — src/common/meta/src/cache/container.rs:254-266 | src/common/meta/src/cache/container.rs:330-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/cache/container.rs:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/common/meta/src/ddl/create_flow.rs:598 — src/common/meta/src/ddl/create_flow.rs:598-610 | src/flow/src/batching_mode/eval_schedule.rs:306-318 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/create_flow.rs:598` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/common/meta/src/key.rs:803 — src/common/meta/src/key.rs:803-815 | src/common/meta/src/key.rs:885-897 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:803` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/common/meta/src/key.rs:797 — src/common/meta/src/key.rs:797-809 | src/common/meta/src/key.rs:1739-1751 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:797` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/common/meta/src/key/flow/flow_route.rs:249 — src/common/meta/src/key/flow/flow_route.rs:249-261 | src/common/meta/src/key/flow/table_flow.rs:294-306 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/flow/flow_route.rs:249` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/common/meta/src/kv_backend/rds/mysql.rs:143 — src/common/meta/src/kv_backend/rds/mysql.rs:143-155 | src/common/meta/src/kv_backend/rds/postgres.rs:175-187 — before extracting anything, compare `src/common/meta/src/kv_backend/rds/mysql.rs` and `src/common/meta/src/kv_backend/rds/postgres.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) src/common/meta/src/kv_backend/rds/postgres.rs:321 — src/common/meta/src/kv_backend/rds/postgres.rs:321-333 | src/common/meta/src/kv_backend/rds/postgres.rs:352-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) src/common/version/src/lib.rs:36 — src/common/version/src/lib.rs:36-48 | src/common/version/src/lib.rs:79-91 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) src/file-engine/src/engine.rs:321 — src/file-engine/src/engine.rs:321-333 | src/relational-engine/src/engine.rs:322-334 — before extracting anything, compare `src/file-engine/src/engine.rs` and `src/relational-engine/src/engine.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 2) src/frontend/src/instance/otlp.rs:204 — src/frontend/src/instance/otlp.rs:204-216 | src/servers/src/http/prom_store.rs:241-253 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/otlp.rs:204` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/meta-srv/src/cluster.rs:85 — src/meta-srv/src/cluster.rs:85-97 | src/meta-srv/src/cluster.rs:134-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/cluster.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/meta-srv/src/gc/procedure.rs:71 — src/meta-srv/src/gc/procedure.rs:71-83 | src/meta-srv/src/gc/procedure.rs:123-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/gc/procedure.rs:71` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/mito2/src/engine.rs:969 — src/mito2/src/engine.rs:969-981 | src/mito2/src/engine.rs:1065-1077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine.rs:969` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) src/mito2/src/read/seq_scan.rs:96 — src/mito2/src/read/seq_scan.rs:96-108 | src/mito2/src/read/unordered_scan.rs:74-86 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/unordered_scan.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/seq_scan.rs:96` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/mito2/src/sst/index/bloom_filter/applier.rs:376 — src/mito2/src/sst/index/bloom_filter/applier.rs:376-388 | src/mito2/src/sst/index/bloom_filter/applier.rs:421-433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) src/mito2/src/sst/parquet/reader.rs:1247 — src/mito2/src/sst/parquet/reader.rs:1247-1259 | src/mito2/src/sst/parquet/reader.rs:1338-1350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:288 — src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:288-300 | src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:345-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `n` to `i64` in one and `u64` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 2) src/query/src/datafusion.rs:649 — src/query/src/datafusion.rs:649-661 | src/query/src/datafusion.rs:684-696 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/datafusion.rs:649` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/query/src/promql/planner.rs:1243 — src/query/src/promql/planner.rs:1243-1255 | src/query/src/promql/planner.rs:1310-1322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:1243` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/servers/src/mysql/handler.rs:637 — src/servers/src/mysql/handler.rs:637-649 | src/servers/src/mysql/handler.rs:717-729 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/mysql/handler.rs:637` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) src/servers/src/postgres/types.rs:1207 — src/servers/src/postgres/types.rs:1207-1219 | src/servers/src/postgres/types.rs:1319-1331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:1207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 11 more in this group — see findings.md.
D35 · Change Coupling · Change coupling · ×33
  • Change coupling: export.rs ↔ import.rs src/cli/src/data/export.rs:1 — `src/cli/src/data/export.rs` and `src/cli/src/data/import.rs` change together 100% of the time (10 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `6adc348f` feat: support parallel table operations in `COPY DATABASE` (#7213); `a049b68c` feat: import backup data from local files (#7180); `11c0381f` chore: set default catalog using build env (#7156) — run `git show` on any of them.
  • Change coupling: region_lease_handler.rs ↔ weight_compute.rs src/meta-srv/src/handler/region_lease_handler.rs:1 — `src/meta-srv/src/handler/region_lease_handler.rs` and `src/meta-srv/src/selector/weight_compute.rs` change together 81% of the time (13 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `4e5b60b8` refactor: rename flushed_parquet_bytes to ingested_parquet_bytes (#10…; `6491700f` fix(meta): forward flushed Parquet bytes in region statistics (#10100); `fbbc017b` feat: expose region min/max timestamp in region_statistics (#9060) — run `git show` on any of them.
  • Change coupling: failure_handler.rs ↔ weight_compute.rs src/meta-srv/src/handler/failure_handler.rs:1 — `src/meta-srv/src/handler/failure_handler.rs` and `src/meta-srv/src/selector/weight_compute.rs` change together 81% of the time (13 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `4e5b60b8` refactor: rename flushed_parquet_bytes to ingested_parquet_bytes (#10…; `6491700f` fix(meta): forward flushed Parquet bytes in region statistics (#10100); `fbbc017b` feat: expose region min/max timestamp in region_statistics (#9060) — run `git show` on any of them.
  • Change coupling: csv.rs ↔ json.rs src/common/datasource/src/file_format/csv.rs:1 — `src/common/datasource/src/file_format/csv.rs` and `src/common/datasource/src/file_format/json.rs` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `a35f9d5c` fix: address Windows test failures and run full Windows CI (#9305); `969a64d4` fix(copy): treat null inferred columns as Utf8 to preserve later valu…; `26535f57` feat: enable concurrent write (#3214) — run `git show` on any of them.
  • Change coupling: empty_table.rs ↔ memtable.rs src/table/src/test_util/empty_table.rs:1 — `src/table/src/test_util/empty_table.rs` and `src/table/src/test_util/memtable.rs` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `e920f959` refactor: drop Table trait (#3654); `d6c82867` refactor: remove the most Table impls (#2274); `7abe71f3` fix(table): return correct table types (#2131) — run `git show` on any of them.
  • Change coupling: create.rs ↔ state.rs src/metric-engine/src/engine/create.rs:1 — `src/metric-engine/src/engine/create.rs` and `src/metric-engine/src/engine/state.rs` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `643bdd72` fix(metric-engine): reuse existing column ids when adding columns is …; `90752f56` feat: persist Prometheus remote write v2 native histograms (#8382); `148d96fc` fix: ensures logical and physical region have the same timestamp unit… — run `git show` on any of them.
  • Change coupling: table_flownode.rs ↔ create_flow.rs src/common/meta/src/cache/flow/table_flownode.rs:1 — `src/common/meta/src/cache/flow/table_flownode.rs` and `src/common/meta/src/ddl/create_flow.rs` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `ba15a9c0` feat: support pending flow metadata with defer_on_missing_source (#8124); `8452a9d5` feat(flow): add eval interval option (#6623); `038acda7` fix: flow update use proper update (#6108) — run `git show` on any of them.
  • Change coupling: context.rs ↔ reader.rs src/mito2/src/memtable/bulk/context.rs:1 — `src/mito2/src/memtable/bulk/context.rs` and `src/mito2/src/sst/parquet/reader.rs` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `5b1b12d0` fix(mito2): adapt batch size for wide rows (#8543); `6a84393e` feat: support prefiltering any columns in flat format (#7972); `922f9cb3` feat: use dyn filter (#7545) — run `git show` on any of them.
  • Change coupling: close_region.rs ↔ open_region.rs src/datanode/src/heartbeat/handler/close_region.rs:1 — `src/datanode/src/heartbeat/handler/close_region.rs` and `src/datanode/src/heartbeat/handler/open_region.rs` change together 69% of the time (9 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `328ec56b` feat: introduce `OpenRegions` and `CloseRegions` instructions to supp…; `b2f61aa1` fix: format error correctly (#4204); `485a91f4` feat: implement handle upgrade region instruction (#3013) — run `git show` on any of them.
  • Change coupling: decode.rs ↔ prom_row_builder.rs src/servers/src/prom_remote_write/decode.rs:1 — `src/servers/src/prom_remote_write/decode.rs` and `src/servers/src/prom_row_builder.rs` change together 65% of the time (11 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `2000611e` perf(remote-write): optimize decode prom (#7761) (at that commit the file was still `src/servers/src/proto.rs`); `7ba23a99` perf: prom decode (#7737) (at that commit the file was still `src/servers/src/proto.rs`); `2f9a10ab` refactor: expose bulk symbols (#6467) (at that commit the file was still `src/servers/src/proto.rs`) — run `git show` on any of them.
  • Change coupling: failure_handler.rs ↔ region_lease_handler.rs src/meta-srv/src/handler/failure_handler.rs:1 — `src/meta-srv/src/handler/failure_handler.rs` and `src/meta-srv/src/handler/region_lease_handler.rs` change together 62% of the time (20 of the 32 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 20 shared commits counted here, the most recent 3 are `4e5b60b8` refactor: rename flushed_parquet_bytes to ingested_parquet_bytes (#10…; `6491700f` fix(meta): forward flushed Parquet bytes in region statistics (#10100); `fbbc017b` feat: expose region min/max timestamp in region_statistics (#9060) — run `git show` on any of them.
  • Change coupling: test_util.rs ↔ handle_create.rs src/mito2/src/test_util.rs:1 — `src/mito2/src/test_util.rs` and `src/mito2/src/worker/handle_create.rs` change together 62% of the time (16 of the 26 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `1ca29c34` feat: support create region requirements (#8281); `24671b60` feat: tracks index files in another cache and preloads them (#7181); `9fe84f6f` feat(mito): backfill partition expr on region open (#6862) — run `git show` on any of them.
  • Change coupling: table_info.rs ↔ table_route.rs src/common/meta/src/key/table_info.rs:1 — `src/common/meta/src/key/table_info.rs` and `src/common/meta/src/key/table_route.rs` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `9aa2182c` refactor: make txn easy to use (#3905); `c91132bd` feat: introduce `TableNameCache` & `TableInfoCache` & `TableRouteCach…; `51078226` refactor: avoid unnecessary cloning (#3734) — run `git show` on any of them.
  • Change coupling: range.rs ↔ reader.rs src/mito2/src/read/range.rs:1 — `src/mito2/src/read/range.rs` and `src/mito2/src/sst/parquet/reader.rs` change together 57% of the time (8 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `ee55c0c2` feat: share concurrent SST metadata loads (#9729); `1451a51e` feat: add tools for development (#8260); `922f9cb3` feat: use dyn filter (#7545) — run `git show` on any of them.
  • Change coupling: lease_based.rs ↔ load_based.rs src/meta-srv/src/selector/lease_based.rs:1 — `src/meta-srv/src/selector/lease_based.rs` and `src/meta-srv/src/selector/load_based.rs` change together 56% of the time (9 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `6a15e627` feat: expose workload filter to selector options (#6951); `4c2955b8` fix: time unit mismatch in `lookup_frontends` function (#6798); `8dca448b` feat: add datanode workloads support (#6055) — run `git show` on any of them.
  • Change coupling: jaeger.rs ↔ v0.rs src/servers/src/http/jaeger.rs:1 — `src/servers/src/http/jaeger.rs` and `src/servers/src/otlp/trace/v0.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6caff50d` chore: improve search traces and jaeger resp (#7166); `0a396192` refactor!: add a `opentelemetry_traces_operations` table to aggregate…; `ee4fe9d2` refactor: improve performance for Jaeger APIs (#5838) — run `git show` on any of them.
  • Change coupling: engine.rs ↔ handle_create.rs src/mito2/src/engine.rs:1 — `src/mito2/src/engine.rs` and `src/mito2/src/worker/handle_create.rs` change together 54% of the time (14 of the 26 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `89a5df31` fix: ignore stale leader grants after a region is downgraded (#9987); `91a59b82` fix: acknowledge writes only within the region's leader lease (#9904); `9fe84f6f` feat(mito): backfill partition expr on region open (#6862) — run `git show` on any of them.
  • Change coupling: parquet.rs ↔ handle_rebuild_index.rs src/mito2/src/sst/parquet.rs:1 — `src/mito2/src/sst/parquet.rs` and `src/mito2/src/worker/handle_rebuild_index.rs` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `54b6bd5b` feat(mito2): support extension index providers and input reuse (#10297); `d2be2980` refactor(mito2): unify builtin index planning and execution (#10293); `bd7d2c1d` fix(mito2): use target sequence for foreign SSTs (#8946) — run `git show` on any of them.
  • Change coupling: reader.rs ↔ bounded_stager.rs src/puffin/src/puffin_manager/fs_puffin_manager/reader.rs:1 — `src/puffin/src/puffin_manager/fs_puffin_manager/reader.rs` and `src/puffin/src/puffin_manager/stager/bounded_stager.rs` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `8d05fb35` feat: unify puffin name passed to stager (#5564); `96b2a5fb` feat: introduce `ParallelFstValuesMapper` (#5276); `cbf21e53` feat(puffin): apply range reader (#4928) — run `git show` on any of them.
  • Change coupling: numbers.rs ↔ memtable.rs src/table/src/table/numbers.rs:1 — `src/table/src/table/numbers.rs` and `src/table/src/test_util/memtable.rs` change together 53% of the time (8 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `3e67c676` refactor: simplify scan projection to root column indices (#8629); `c90e4147` refactor: introduce the ProjectInput structure (#7908); `e375a180` fix: conversion from TableMeta to TableMetaBuilder (#5693) — run `git show` on any of them.
  • Change coupling: prom_store.rs ↔ prom_row_builder.rs src/servers/src/http/prom_store.rs:1 — `src/servers/src/http/prom_store.rs` and `src/servers/src/prom_row_builder.rs` change together 53% of the time (9 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `fedce5c5` feat: support non-millisecond time index units in the logical batcher…; `941193e9` refactor: reorganize logical table batching and isolate encoding (#9210); `2000611e` perf(remote-write): optimize decode prom (#7761) — run `git show` on any of them.
  • Change coupling: test.rs ↔ commutativity.rs src/query/src/dist_plan/analyzer/test.rs:1 — `src/query/src/dist_plan/analyzer/test.rs` and `src/query/src/dist_plan/commutativity.rs` change together 52% of the time (13 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `0dab3aef` fix(query): preserve IGNORE NULLS semantics in distributed queries (#…; `c5129383` fix(query): push LIKE filters down into MergeScan remote plans (#9648); `def0c2ec` fix: only push down aggregates grouped by the partition columns thems… — run `git show` on any of them.
  • Change coupling: create_table.rs ↔ drop_table.rs src/common/meta/src/ddl/create_table.rs:1 — `src/common/meta/src/ddl/create_table.rs` and `src/common/meta/src/ddl/drop_table.rs` change together 50% of the time (18 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 shared commits counted here, the most recent 3 are `8aefcfae` fix(meta): renew operating region leases from keeper roles (#7971); `dca451c4` fix: remap peer addresses during retries (#7933); `981d5178` fix: throw errors instead of ignoring (#5792) — run `git show` on any of them.
  • Change coupling: flush.rs ↔ handle_close.rs src/mito2/src/flush.rs:1 — `src/mito2/src/flush.rs` and `src/mito2/src/worker/handle_close.rs` change together 50% of the time (9 of the 18 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `8da533c3` fix(mito2): keep rows written during staging in the WAL (#10253); `a026b3b2` fix(mito): flush memtables containing skip-WAL writes on region close…; `59e4e7ef` fix: preserve close-time flush responses (#8443) — run `git show` on any of them.
  • Change coupling: data_region.rs ↔ create.rs src/metric-engine/src/data_region.rs:1 — `src/metric-engine/src/data_region.rs` and `src/metric-engine/src/engine/create.rs` change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `643bdd72` fix(metric-engine): reuse existing column ids when adding columns is …; `b462d5d1` fix: honor default prefix for all metric columns (#8640); `90752f56` feat: persist Prometheus remote write v2 native histograms (#8382) — run `git show` on any of them.
  • + 8 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×31
  • Duplicated block (6 lines × 2) src/common/function/src/flush_flow.rs:81 — src/common/function/src/flush_flow.rs:81-86 | src/frontend/src/instance.rs:1815-1820 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/flush_flow.rs:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/common/function/src/scalars/vector/scalar_add.rs:90 — src/common/function/src/scalars/vector/scalar_add.rs:90-95 | src/common/function/src/scalars/vector/scalar_mul.rs:90-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/vector/scalar_add.rs:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) src/common/meta/src/key/flow/flow_state.rs:256 — src/common/meta/src/key/flow/flow_state.rs:256-261 | src/common/meta/src/key/flow/flow_state.rs:328-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/flow/flow_state.rs:328` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/common/runtime/src/runtime.rs:145 — src/common/runtime/src/runtime.rs:145-150 | src/common/runtime/src/runtime.rs:188-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) src/datatypes/src/value.rs:1247 — src/datatypes/src/value.rs:1247-1253 | src/datatypes/src/vectors/helper.rs:149-154 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) src/mito2/src/memtable/simple_bulk_memtable.rs:127 — src/mito2/src/memtable/simple_bulk_memtable.rs:127-132 | src/mito2/src/memtable/time_series.rs:261-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/mito2/src/memtable/simple_bulk_memtable.rs:126` calls `fetch_add` and `src/mito2/src/memtable/time_series.rs:260` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) src/mito2/src/read/flat_merge.rs:829 — src/mito2/src/read/flat_merge.rs:829-834 | src/mito2/src/read/flat_merge.rs:984-989 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/flat_merge.rs:829` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/promql/src/extension_plan/absent.rs:478 — src/promql/src/extension_plan/absent.rs:478-483 | src/promql/src/extension_plan/absent.rs:492-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/absent.rs:478` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/query/src/optimizer/count_nest_aggr.rs:302 — src/query/src/optimizer/count_nest_aggr.rs:302-307 | src/query/src/optimizer/count_nest_aggr.rs:322-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/optimizer/count_nest_aggr.rs:302` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) src/query/src/promql/planner.rs:2015 — src/query/src/promql/planner.rs:2015-2020 | src/query/src/promql/planner.rs:6293-6298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:2015` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/servers/src/http/handler.rs:228 — src/servers/src/http/handler.rs:228-233 | src/servers/src/http/handler.rs:962-967 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) src/servers/src/http/memory_limit.rs:63 — src/servers/src/http/memory_limit.rs:63-68 | src/servers/src/http/memory_limit.rs:151-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/servers/src/http/memory_limit.rs:147` calls `extensions`, `is_none`, `run` and `src/servers/src/http/memory_limit.rs:62` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) src/store-api/src/region_info.rs:107 — src/store-api/src/region_info.rs:107-112 | src/store-api/src/sst_entry.rs:472-477 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) src/common/function/src/scalars/geo/h3.rs:107 — src/common/function/src/scalars/geo/h3.rs:107-112 | src/common/function/src/scalars/geo/s2.rs:90-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/common/function/src/scalars/ip/cidr.rs:115 — src/common/function/src/scalars/ip/cidr.rs:115-120 | src/common/function/src/scalars/ip/cidr.rs:244-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/ip/cidr.rs:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/operator/src/insert.rs:687 — src/operator/src/insert.rs:687-692 | src/operator/src/insert.rs:1002-1007 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/insert.rs:687` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/operator/src/statement/show.rs:284 — src/operator/src/statement/show.rs:284-289 | src/operator/src/statement/show.rs:333-338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/statement/show.rs:284` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/common/batcher/src/flush_limiter.rs:27 — src/common/batcher/src/flush_limiter.rs:27-32 | src/common/batcher/src/request_limiter.rs:30-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) src/promql/src/functions/aggr_over_time.rs:230 — src/promql/src/functions/aggr_over_time.rs:230-235 | src/promql/src/functions/idelta.rs:52-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) src/common/function/src/scalars/date/date_add.rs:74 — src/common/function/src/scalars/date/date_add.rs:74-79 | src/common/function/src/scalars/date/date_sub.rs:72-77 — before extracting anything, compare `src/common/function/src/scalars/date/date_add.rs` and `src/common/function/src/scalars/date/date_sub.rs` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/date/date_add.rs:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/common/function/src/system/pg_catalog.rs:63 — src/common/function/src/system/pg_catalog.rs:63-68 | src/common/function/src/system/timezone.rs:44-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/system/pg_catalog.rs:63` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) src/common/meta/src/key/catalog_name.rs:101 — src/common/meta/src/key/catalog_name.rs:101-106 | src/common/meta/src/key/schema_name.rs:189-194 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) src/datatypes/src/vectors/decimal.rs:57 — src/datatypes/src/vectors/decimal.rs:57-62 | src/datatypes/src/vectors/primitive.rs:69-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `array` to `Decimal128Array` in one and `impl AsRef<dyn Array>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 2) src/mito2/src/sst/index/bloom_filter/applier.rs:103 — src/mito2/src/sst/index/bloom_filter/applier.rs:103-108 | src/mito2/src/sst/index/inverted_index/applier.rs:106-112 — `src/mito2/src/sst/index/bloom_filter/applier.rs` and `src/mito2/src/sst/index/inverted_index/applier.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 71 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (6 lines × 2) src/pipeline/src/manager/pipeline_cache.rs:85 — src/pipeline/src/manager/pipeline_cache.rs:85-90 | src/pipeline/src/manager/pipeline_cache.rs:105-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/manager/pipeline_cache.rs:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 6 more in this group — see findings.md.
D2 · Cognitive Complexity · servers · ×29
  • servers::postgres::types::parameters_to_scalar_values (cognitive 205) src/servers/src/postgres/types.rs:574 — servers::postgres::types::parameters_to_scalar_values has cognitive complexity 205 (threshold 15). Drivers by points: if/else 55 (117 pts), match/switch 23 (85 pts), boolean chains 2, loops 1 (nesting depth added 124). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::otlp::metrics::prepare::prepare_metrics (cognitive 172) src/servers/src/otlp/metrics/prepare.rs:70 — servers::otlp::metrics::prepare::prepare_metrics has cognitive complexity 172 (threshold 15). Drivers by points: if/else 24 (132 pts), loops 8 (30 pts), boolean chains 6, match/switch 1 (4 pts) (nesting depth added 133). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::jaeger::traces_from_records (cognitive 162) src/servers/src/http/jaeger.rs:769 — servers::http::jaeger::traces_from_records has cognitive complexity 162 (threshold 15). Drivers by points: if/else 34 (134 pts), loops 6 (17 pts), boolean chains 8, match/switch 1 (3 pts) (nesting depth added 113). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::prom_store::exemplar::write (cognitive 66) src/servers/src/http/prom_store/exemplar.rs:46 — servers::http::prom_store::exemplar::write has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (44 pts), loops 4 (9 pts), match/switch 3 (7 pts), boolean chains 6 (nesting depth added 34). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • servers::batcher::table::pending_worker::start_worker (cognitive 48) src/servers/src/batcher/table/pending_worker.rs:64 — servers::batcher::table::pending_worker::start_worker has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (35 pts), loops 2 (6 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::prom_remote_write::v2::decode_series_leaves (cognitive 42) src/servers/src/prom_remote_write/v2.rs:724 — servers::prom_remote_write::v2::decode_series_leaves has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (34 pts), match/switch 2 (7 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::otlp::metrics::encode_histogram (cognitive 39) src/servers/src/otlp/metrics.rs:1157 — servers::otlp::metrics::encode_histogram has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::prom_remote_write::v2::convert_remote_write_v2 (cognitive 37) src/servers/src/prom_remote_write/v2.rs:314 — servers::prom_remote_write::v2::convert_remote_write_v2 has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 2 (4 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::result::prometheus_resp::merge_batch (cognitive 36) src/servers/src/http/result/prometheus_resp.rs:455 — servers::http::result::prometheus_resp::merge_batch has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 3 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::pipeline::run_custom_pipeline (cognitive 34) src/servers/src/pipeline.rs:99 — servers::pipeline::run_custom_pipeline has cognitive complexity 34 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 3 (9 pts), match/switch 4 (9 pts) (nesting depth added 20). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • servers::otlp::metrics::prepare::conflicting_points (cognitive 31) src/servers/src/otlp/metrics/prepare.rs:589 — servers::otlp::metrics::prepare::conflicting_points has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 8 (14 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::prom_store::query_to_plan (cognitive 30) src/servers/src/prom_store.rs:170 — servers::prom_store::query_to_plan has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (27 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::mysql::writer::write_output (cognitive 29) src/servers/src/mysql/writer.rs:60 — servers::mysql::writer::write_output has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 6 (18 pts), if/else 2 (6 pts), loops 3 (5 pts) (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • servers::batcher::logical_table::pending_worker::start_worker (cognitive 27) src/servers/src/batcher/logical_table/pending_worker.rs:102 — servers::batcher::logical_table::pending_worker::start_worker has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 2 (5 pts), match/switch 2 (5 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::handler::from_output (cognitive 27) src/servers/src/http/handler.rs:806 — servers::http::handler::from_output has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 5 (18 pts), if/else 2 (8 pts), loops 1 (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • servers::http::handler::sql_analyze_stream (cognitive 23) src/servers/src/http/handler.rs:384 — servers::http::handler::sql_analyze_stream has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 4 (7 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::postgres::copy_in::parse::scan_copy_from_stdin (cognitive 23) src/servers/src/postgres/copy_in/parse.rs:62 — servers::postgres::copy_in::parse::scan_copy_from_stdin has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • servers::http::prometheus::label_values_query (cognitive 22) src/servers/src/http/prometheus.rs:1852 — servers::http::prometheus::label_values_query has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::prom_store::remote_write_v2 (cognitive 21) src/servers/src/http/prom_store.rs:321 — servers::http::prom_store::remote_write_v2 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 2 (3 pts), match/switch 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • servers::http::prom_store::write_batched_prometheus_v2_rows_with_progress (cognitive 21) src/servers/src/http/prom_store.rs:722 — servers::http::prom_store::write_batched_prometheus_v2_rows_with_progress has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::otlp::metrics::convert_bucket_range (cognitive 19) src/servers/src/otlp/metrics.rs:778 — servers::otlp::metrics::convert_bucket_range has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (5 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::authorize::inner_auth (cognitive 17) src/servers/src/http/authorize.rs:80 — servers::http::authorize::inner_auth has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::jaeger::v3::summary::summarize (cognitive 17) src/servers/src/http/jaeger/v3/summary.rs:24 — servers::http::jaeger::v3::summary::summarize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (7 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • servers::http::prometheus::update_metric_name_matcher (cognitive 17) src/servers/src/http/prometheus.rs:1788 — servers::http::prometheus::update_metric_name_matcher has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • servers::mysql::federated::has_trailing_statement (cognitive 17) src/servers/src/mysql/federated.rs:472 — servers::mysql::federated::has_trailing_statement has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • + 4 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×28
  • Edited copy of a member (9 corresponding lines) .github/scripts/agent-observability-summary.py:214 — .github/scripts/agent-observability-summary.py:214-222 | .github/scripts/tracesbench-summary.py:156-165 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/meta/src/ddl/create_table.rs:391 — src/common/meta/src/ddl/create_table.rs:391-399 | src/common/meta/src/ddl/create_view.rs:264-272 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/cli/src/data/snapshot_storage.rs:524 — src/cli/src/data/snapshot_storage.rs:524-532 | src/cli/src/data/snapshot_storage.rs:539-547 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/datatypes/src/vectors/helper.rs:349 — src/datatypes/src/vectors/helper.rs:349-357 | src/datatypes/src/vectors/helper.rs:359-367 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/mito-codec/src/row_converter/dense.rs:451 — src/mito-codec/src/row_converter/dense.rs:451-459 | src/mito-codec/src/row_converter/dense.rs:500-508 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/cmd/src/bin/query_regression_runner/sql.rs:86 — src/cmd/src/bin/query_regression_runner/sql.rs:86-94 | src/cmd/src/bin/query_regression_runner/sql.rs:241-250 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/meta/src/kv_backend/txn.rs:169 — src/common/meta/src/kv_backend/txn.rs:169-177 | src/common/meta/src/kv_backend/txn.rs:181-190 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/file-engine/src/query/file_stream.rs:83 — src/file-engine/src/query/file_stream.rs:83-97 | src/file-engine/src/query/file_stream.rs:170-178 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/catalog/src/system_schema/pg_catalog.rs:201 — src/catalog/src/system_schema/pg_catalog.rs:201-209 | src/catalog/src/system_schema/pg_catalog.rs:216-224 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/sql/src/statements/truncate.rs:33 — src/sql/src/statements/truncate.rs:33-41 | src/sql/src/statements/truncate.rs:45-53 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/datatypes/src/vectors/binary.rs:427 — src/datatypes/src/vectors/binary.rs:427-435 | src/datatypes/src/vectors/decimal.rs:231-239 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/mito2/src/read/dedup.rs:466 — src/mito2/src/read/dedup.rs:466-474 | src/mito2/src/read/flat_dedup.rs:69-77 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/promql/src/extension_plan/normalize.rs:320 — src/promql/src/extension_plan/normalize.rs:320-330 | src/promql/src/extension_plan/series_divide.rs:413-421 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/mito2/src/series_index/writer.rs:431 — src/mito2/src/series_index/writer.rs:431-440 | src/mito2/src/sst/range_index/writer.rs:454-462 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/cmd/src/datanode/parquet_rewrite.rs:255 — src/cmd/src/datanode/parquet_rewrite.rs:255-263 | src/cmd/src/datanode/tool_util.rs:194-205 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/object-store/src/secure_fs.rs:77 — src/object-store/src/secure_fs.rs:77-88 | src/object-store/src/secure_fs.rs:236-244 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/meta/src/key/table_name.rs:212 — src/common/meta/src/key/table_name.rs:212-220 | src/common/meta/src/key/table_name.rs:228-239 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/meta/src/ddl/event/view.rs:193 — src/common/meta/src/ddl/event/view.rs:193-202 | src/common/meta/src/reconciliation/event.rs:92-100 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/function/src/aggrs/approximate/hll.rs:183 — src/common/function/src/aggrs/approximate/hll.rs:183-191 | src/common/function/src/aggrs/approximate/uddsketch.rs:209-217 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/sql/src/statements/create.rs:77 — src/sql/src/statements/create.rs:77-85 | src/sql/src/statements/option_map.rs:151-159 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/function/src/admin/gc.rs:174 — src/common/function/src/admin/gc.rs:174-182 | src/common/function/src/admin/reconcile_table.rs:97-107 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/datanode/src/region_server.rs:1079 — src/datanode/src/region_server.rs:1079-1087 | src/datanode/src/region_server/remote_dyn_filter.rs:329-337 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/meta/src/kv_backend/rds/postgres.rs:76 — src/common/meta/src/kv_backend/rds/postgres.rs:76-84 | src/servers/src/tls.rs:95-103 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/common/meta/src/ddl/event/flow.rs:140 — src/common/meta/src/ddl/event/flow.rs:140-148 | src/common/meta/src/ddl/event/view.rs:176-185 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) src/datanode/src/config.rs:126 — src/datanode/src/config.rs:126-136 | src/standalone/src/options.rs:229-237 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 3 more in this group — see findings.md.
D31 · IaC & Container Security · Medium IaC · ×27
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×26
  • Edited copy of a member (14 corresponding lines) src/datatypes/src/vectors/string.rs:399 — src/datatypes/src/vectors/string.rs:399-413 | src/datatypes/src/vectors/string.rs:439-452 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/partition/src/overlap.rs:144 — src/partition/src/overlap.rs:144-157 | src/partition/src/overlap.rs:159-172 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/index/src/bitmap.rs:125 — src/index/src/bitmap.rs:125-144 | src/index/src/bitmap.rs:150-163 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/datatypes/src/scalars.rs:329 — src/datatypes/src/scalars.rs:329-346 | src/datatypes/src/scalars.rs:365-378 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/sql/src/statements/option_map.rs:107 — src/sql/src/statements/option_map.rs:107-120 | src/sql/src/statements/option_map.rs:125-138 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/cmd/src/bin/query_regression_runner/plan.rs:88 — src/cmd/src/bin/query_regression_runner/plan.rs:88-104 | src/cmd/src/bin/query_regression_runner/plan.rs:109-122 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/grpc-expr/src/alter.rs:166 — src/common/grpc-expr/src/alter.rs:166-179 | src/store-api/src/region_request.rs:974-992 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/catalog/src/system_schema/information_schema/flow_statistics.rs:278 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:278-291 | src/catalog/src/system_schema/information_schema/flows.rs:464-477 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/servers/src/mysql/server.rs:259 — src/servers/src/mysql/server.rs:259-275 | src/servers/src/postgres/server.rs:202-215 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/function/src/scalars/ai.rs:335 — src/common/function/src/scalars/ai.rs:335-349 | src/common/function/src/scalars/ai.rs:376-389 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/catalog/src/system_schema/memory_table.rs:95 — src/catalog/src/system_schema/memory_table.rs:95-108 | src/catalog/src/system_schema/memory_table.rs:130-148 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/meta/src/kv_backend/chroot.rs:96 — src/common/meta/src/kv_backend/chroot.rs:96-109 | src/common/meta/src/kv_backend/chroot.rs:139-152 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/session/src/session_config.rs:155 — src/session/src/session_config.rs:155-168 | src/session/src/session_config.rs:212-225 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/servers/src/prom_remote_write/row_builder.rs:192 — src/servers/src/prom_remote_write/row_builder.rs:192-206 | src/servers/src/prom_remote_write/v2.rs:1097-1110 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/recordbatch/src/adapter.rs:254 — src/common/recordbatch/src/adapter.rs:254-267 | src/common/recordbatch/src/adapter.rs:269-283 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/meta/src/key/catalog_name.rs:140 — src/common/meta/src/key/catalog_name.rs:140-153 | src/common/meta/src/key/schema_name.rs:323-336 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/datatypes/src/vectors/dictionary.rs:297 — src/datatypes/src/vectors/dictionary.rs:297-310 | src/datatypes/src/vectors/list.rs:173-189 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/mito2/src/region.rs:2272 — src/mito2/src/region.rs:2272-2285 | src/mito2/src/region.rs:2362-2375 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/procedure/src/store.rs:144 — src/common/procedure/src/store.rs:144-157 | src/common/procedure/src/store.rs:182-196 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/partition/src/manager.rs:123 — src/partition/src/manager.rs:123-138 | src/partition/src/manager.rs:176-189 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/file-engine/src/engine.rs:212 — src/file-engine/src/engine.rs:212-225 | src/relational-engine/src/engine.rs:187-200 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/common/function/src/scalars/json/json_object_keys.rs:33 — src/common/function/src/scalars/json/json_object_keys.rs:33-46 | src/common/function/src/scalars/json/json_to_string.rs:33-46 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/query/src/query_engine.rs:165 — src/query/src/query_engine.rs:165-178 | src/query/src/query_engine/state.rs:131-144 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) tests-fuzz/src/translator/mysql/alter_expr.rs:33 — tests-fuzz/src/translator/mysql/alter_expr.rs:33-46 | tests-fuzz/src/translator/postgres/alter_expr.rs:33-46 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) src/cmd/src/bin/query_perf_fixture/direct_sst.rs:156 — src/cmd/src/bin/query_perf_fixture/direct_sst.rs:156-177 | src/mito2/src/test_util/sst_util.rs:280-293 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×25
  • TooManyMethods: ParserContext src/sql/src/parser.rs:43 — TooManyMethods — 145 methods, declared across 24 files: parsers/create_parser.rs (26), parsers/alter_parser.rs (19), parsers/show_parser.rs (19), src/parser.rs (18), +20 more file(s). The bar is 30 methods; this is 115 over it, 4.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PromPlanner src/query/src/promql/planner.rs:290 — TooManyMethods — 140 methods, declared across 5 files: promql/planner.rs (117), planner/at_modifier.rs (8), planner/function_plans.rs (7), planner/island.rs (5), +1 more file(s). The bar is 30 methods; this is 110 over it, 4.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StatementExecutor src/operator/src/statement.rs:139 — TooManyMethods — 125 methods, declared across 18 files: statement/ddl.rs (49), statement/show.rs (22), src/statement.rs (18), statement/copy_table_to.rs (6), +14 more file(s). The bar is 30 methods; this is 95 over it, 4.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Instance src/frontend/src/instance.rs:118 — TooManyMethods — 106 methods, declared across 15 files: src/instance.rs (39), otlp/trace_ingest.rs (23), instance/grpc.rs (10), instance/dashboard.rs (7), +11 more file(s). The bar is 30 methods; this is 76 over it, 3.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RegionWorkerLoop src/mito2/src/worker.rs:1180 — TooManyMethods — 106 methods, declared across 20 files: worker/handle_manifest.rs (19), worker/handle_write.rs (13), src/worker.rs (11), worker/handle_flush.rs (10), +16 more file(s). The bar is 30 methods; this is 76 over it, 3.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MetricEngineInner src/metric-engine/src/engine.rs:641 — TooManyMethods — 69 methods, declared across 14 files: engine/put.rs (19), engine/read.rs (12), engine/open.rs (10), engine/create.rs (7), +10 more file(s). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: QueryContext src/session/src/context.rs:67 — TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ConcreteDataType src/datatypes/src/data_type.rs:46 — TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MitoRegion src/mito2/src/region.rs:168 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BatchingTask src/flow/src/batching_mode/task.rs:293 — TooManyMethods — 54 methods, declared across 3 files: batching_mode/task.rs (45), task/ckpt.rs (5), task/inc.rs (4). The bar is 30 methods; this is 24 over it, 1.80× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ColumnSchema src/datatypes/src/schema/column_schema.rs:88 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RegionServer src/datanode/src/region_server.rs:115 — TooManyMethods — 50 methods, declared across 3 files: src/region_server.rs (39), region_server/remote_dyn_filter.rs (6), region_server/catalog.rs (5). The bar is 30 methods; this is 20 over it, 1.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: TableMetadataManager src/common/meta/src/key.rs:401 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CompactionScheduler src/mito2/src/compaction/scheduler.rs:116 — TooManyMethods — 43 methods, declared across 3 files: compaction/scheduler.rs (28), scheduler/local.rs (8), scheduler/planning.rs (7). The bar is 30 methods; this is 13 over it, 1.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Actor src/log-store/src/object_store_wal/store.rs:1516 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Metasrv src/meta-srv/src/metasrv.rs:587 — TooManyMethods — 42 methods, declared across 3 files: src/metasrv.rs (36), service/procedure.rs (4), service/cluster.rs (2). The bar is 30 methods; this is 12 over it, 1.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Inserter src/operator/src/insert.rs:113 — TooManyMethods — 42 methods, declared across 3 files: src/insert.rs (37), src/bulk_insert.rs (4), insert/otlp.rs (1). The bar is 30 methods; this is 12 over it, 1.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MitoEngine src/mito2/src/engine.rs:298 — TooManyMethods — 40 methods, declared across 2 files: src/engine.rs (38), engine/table_compaction.rs (2). The bar is 30 methods; this is 10 over it, 1.33× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Timestamp src/common/time/src/timestamp.rs:46 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NativeHistogram src/common/query/src/native_histogram.rs:269 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ManifestContext src/mito2/src/region.rs:1365 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ParquetReaderBuilder src/mito2/src/sst/parquet/reader.rs:190 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: WorkerListener src/mito2/src/worker.rs:1870 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Batch src/mito2/src/read.rs:116 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: DdlManager src/common/meta/src/ddl_manager.rs:111 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D15 · Churn × Complexity Hotspots · Repeated repair · ×24
  • Repeated repair: src/mito2/src/compaction/twcs.rs src/mito2/src/compaction/twcs.rs:386 — src/mito2/src/compaction/twcs.rs changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is TwcsPicker::pick_window at line 386), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): prevent automatic compaction candidate starvation (#9946)”; “fix(mito2): pick TWCS L1 merges by closed units so compaction terminates (#9741)”; “fix: align TWCS assignment with half-open time windows (#9464)”; “fix(mito2): compare primary key ranges across schema versions (#9205)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/compaction/twcs.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/servers/src/prom_store.rs src/servers/src/prom_store.rs:485 — src/servers/src/prom_store.rs changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is servers::prom_store::append_recordbatch_to_timeseries at line 485), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: optimize Prometheus remote write v2 ingestion (#9928)”; “fix(prom): align remote read label matcher semantics (#9633)”; “fix(prom): return empty remote read results for missing metrics (#9613)”; “fix: bound decompressed request size and close memory-admission gaps for compressed requests (#9264)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/servers/src/prom_store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/region_write_ctx.rs src/mito2/src/region_write_ctx.rs:410 — src/mito2/src/region_write_ctx.rs changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is RegionWriteCtx::write_bulk at line 410), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: optimize Prometheus remote write v2 ingestion (#9928)”; “fix: acknowledge writes only within the region's leader lease (#9904)”; “fix(mito2): validate bulk insert batches against the region schema (#9698)”; “fix(mito2): keep processing bulk requests after one fails to encode (#9638)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/region_write_ctx.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/manifest/storage/delta.rs src/mito2/src/manifest/storage/delta.rs:185 — src/mito2/src/manifest/storage/delta.rs changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is DeltaStorage::fetch_manifests_from_entries at line 185), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): commit staging edits once when staging ends (#10322)”; “fix(mito2): publish manifest deltas by conditional create under a lease (#10234)”; “fix(mito): decode cached manifest payloads (#10179)”; “fix(mito): use stored recovery-set bytes for manifest size (#10142)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/manifest/storage/delta.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/session/src/lib.rs src/session/src/lib.rs:217 — src/session/src/lib.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is Session::add_warning at line 217), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(auth): secure MySQL and PostgreSQL database selection (#10382)”; “fix: optimize Prometheus remote write v2 ingestion (#9928)”; “fix: postgres describe for more statements (#8974)”; “fix: update tokio-postgres and correct explain/fetch cursor output schema (#8955)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/session/src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/meta-srv/src/region/supervisor.rs src/meta-srv/src/region/supervisor.rs:443 — src/meta-srv/src/region/supervisor.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is RegionSupervisor::run at line 443), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(meta-srv): stop failing over regions that are still opening (#10290)”; “fix(meta): exclude route followers from failover targets (#10001)”; “fix(meta): allow affinity fallback during failover (#9641)”; “fix(metasrv): stop parking the heartbeat response on the region supervisor queue (#9474)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/meta-srv/src/region/supervisor.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/compaction/picker.rs src/mito2/src/compaction/picker.rs:126 — src/mito2/src/compaction/picker.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is mito2::compaction::picker::new_picker at line 126), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): prevent automatic compaction candidate starvation (#9946)”; “fix(mito2): pick TWCS L1 merges by closed units so compaction terminates (#9741)”; “fix(mito2): compare primary key ranges across schema versions (#9205)”; “fix(mito2): preserve last-non-null values across compaction (#9169)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/compaction/picker.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/worker/handle_create.rs src/mito2/src/worker/handle_create.rs:30 — src/mito2/src/worker/handle_create.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is RegionWorkerLoop::handle_create_request at line 30), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): publish manifest deltas by conditional create under a lease (#10234)”; “fix: ignore stale leader grants after a region is downgraded (#9987)”; “fix: acknowledge writes only within the region's leader lease (#9904)”; “fix: reclaim HDFS temporary files left behind by a datanode crash (#9616)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/worker/handle_create.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/memtable.rs src/mito2/src/memtable.rs:492 — src/mito2/src/memtable.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is MemtableBuilderProvider::builder_for_options at line 492), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): share bulk memtable compaction dispatcher across workers (#10022)”; “fix(mito2): require flat SST output for JSON2 (#9893)”; “fix(mito): preserve version ordering in bulk merges and flushes (#9517)”; “fix(mito2): preserve last-non-null values across compaction (#9169)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/memtable.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: .github/scripts/aliyun-ecs-runner-provision.py .github/scripts/aliyun-ecs-runner-provision.py:440 — .github/scripts/aliyun-ecs-runner-provision.py changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is aliyun-ecs-runner-provision.main at line 440), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ci): scope Aliyun janitor sweeps to the owning repository (#9966)”; “fix(ci): repair agent observability dispatch and runner cleanup (#9204)”; “fix(ci): increase query regression ECS disk to 80 GiB (#9123)”; “fix: increase system disk size to 50 GiB for ECS instances (#8986)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- .github/scripts/aliyun-ecs-runner-provision.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/manifest/storage.rs src/mito2/src/manifest/storage.rs:307 — src/mito2/src/manifest/storage.rs changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is ManifestObjectStore::delete_until at line 307), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): commit staging edits once when staging ends (#10322)”; “fix(mito2): publish manifest deltas by conditional create under a lease (#10234)”; “fix(mito): decode cached manifest payloads (#10179)”; “fix(mito): use stored recovery-set bytes for manifest size (#10142)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/manifest/storage.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/query/src/promql/error.rs src/query/src/promql/error.rs:260 — src/query/src/promql/error.rs changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is Error::status_code at line 260), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(promql): return range-vector results for instant queries (#9477)”; “fix(promql): align subqueries to the absolute evaluation grid (#9400)”; “fix(promql): align timestamp(), label_join and label_replace with Prometheus semantics (#9385)”; “fix(prometheus): honor label matchers in __name__ values query (#9134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/query/src/promql/error.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/meta-srv/src/handler/failure_handler.rs src/meta-srv/src/handler/failure_handler.rs:46 — src/meta-srv/src/handler/failure_handler.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is RegionFailureHandler::handle at line 46), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(meta-srv): stop failing over regions that are still opening (#10290)”; “fix(meta): forward flushed Parquet bytes in region statistics (#10100)”; “fix(metasrv): stop parking the heartbeat response on the region supervisor queue (#9474)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/meta-srv/src/handler/failure_handler.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/promql/src/extension_plan/normalize.rs src/promql/src/extension_plan/normalize.rs:408 — src/promql/src/extension_plan/normalize.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is SeriesNormalizeStream::normalize at line 408), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(promql): collapse duplicate samples at one timestamp before range functions (#10069)”; “fix(promql): resolve dotted column names as unqualified columns (#9391)”; “fix(promql): preserve native timestamps through sample selection (#9070)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/promql/src/extension_plan/normalize.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/promql/src/extension_plan/range_manipulate.rs src/promql/src/extension_plan/range_manipulate.rs:684 — src/promql/src/extension_plan/range_manipulate.rs changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is RangeManipulateStream::manipulate at line 684), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(promql): collapse duplicate samples at one timestamp before range functions (#10069)”; “fix(promql): resolve dotted column names as unqualified columns (#9391)”; “fix(promql): preserve native timestamps through sample selection (#9070)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/promql/src/extension_plan/range_manipulate.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/query/src/promql/label_values.rs src/query/src/promql/label_values.rs:65 — src/query/src/promql/label_values.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is query::promql::label_values::timestamp_to_scalar_value at line 65), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(promql): accept evaluation times before the Unix epoch (#9480)”; “fix: address Windows test failures and run full Windows CI (#9305)”; “fix(prometheus): honor label matchers in __name__ values query (#9134)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/query/src/promql/label_values.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/compaction/last_non_null.rs src/mito2/src/compaction/last_non_null.rs:141 — src/mito2/src/compaction/last_non_null.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is mito2::compaction::last_non_null::build_closed_outputs at line 141), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): prevent automatic compaction candidate starvation (#9946)”; “fix(mito2): pick TWCS L1 merges by closed units so compaction terminates (#9741)”; “fix(mito2): compare primary key ranges across schema versions (#9205)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/compaction/last_non_null.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/pipeline/src/manager/pipeline_operator.rs src/pipeline/src/manager/pipeline_operator.rs:108 — src/pipeline/src/manager/pipeline_operator.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is PipelineOperator::create_pipeline_table_if_not_exists at line 108), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: tolerate invalid UTF-8 in JSON log ingestion (#10245)”; “fix(pipeline)!: disable VRL host access by default (#9610)”; “fix(pipeline): coalesce concurrent pipeline cache misses (#9022)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/pipeline/src/manager/pipeline_operator.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/meta-srv/src/handler/collect_stats_handler.rs src/meta-srv/src/handler/collect_stats_handler.rs:105 — src/meta-srv/src/handler/collect_stats_handler.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is CollectStatsHandler::handle at line 105), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(meta): invalidate all datanode tables on address change (#9986)”; “fix(metasrv): retry failed heartbeat address updates (#9437)”; “fix(meta): avoid blocking runtime on stats cache lock (#8910)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/meta-srv/src/handler/collect_stats_handler.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/meta-srv/src/handler.rs src/meta-srv/src/handler.rs:773 — src/meta-srv/src/handler.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is HeartbeatHandlerGroupBuilder::add_default_handlers at line 773), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(meta): fence datanode processes replaced by a newer process (#9878)”; “fix(metasrv): stop holding the pusher registry lock across mailbox sends (#9445)”; “fix(metasrv): retry failed heartbeat address updates (#9437)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/meta-srv/src/handler.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/memtable/time_series.rs src/mito2/src/memtable/time_series.rs:1050 — src/mito2/src/memtable/time_series.rs changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is ValueBuilder::extend at line 1050), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): validate bulk insert batches against the region schema (#9698)”; “fix(promql): restore exact filtering for nullable label matchers (#9418)”; “fix(mito2): preserve last-non-null values across compaction (#9169)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/memtable/time_series.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/mito2/src/manifest/storage/checkpoint.rs src/mito2/src/manifest/storage/checkpoint.rs:98 — src/mito2/src/manifest/storage/checkpoint.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is CheckpointStorage::load_checkpoint at line 98), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mito2): publish manifest deltas by conditional create under a lease (#10234)”; “fix(mito): decode cached manifest payloads (#10179)”; “fix(mito): use stored recovery-set bytes for manifest size (#10142)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/mito2/src/manifest/storage/checkpoint.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/meta-srv/src/service/store/cached_kv.rs src/meta-srv/src/service/store/cached_kv.rs:177 — src/meta-srv/src/service/store/cached_kv.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is LeaderCachedKvBackend::range at line 177), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(meta-srv): invalidate leader cache on transaction errors (#10219)”; “fix(meta): fence datanode processes replaced by a newer process (#9878)”; “fix: prevent stale leader metadata after concurrent writes (#9549)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/meta-srv/src/service/store/cached_kv.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: src/catalog/src/process_manager.rs src/catalog/src/process_manager.rs:453 — src/catalog/src/process_manager.rs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is SlowQueryTimer::drop at line 453), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(catalog): use advertised peer address as process identity (#10153)”; “fix(catalog): propagate frontend process-list failures (#9999)”; “fix: decouple slow-query logging from the global log level (#9765)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 02:29:06 +00:00' --until='2026-11-14 02:29:06 +00:00' --full-history --no-merges -- src/catalog/src/process_manager.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×24
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D2 · Cognitive Complexity · mito2 · ×23
  • mito2::read::seq_scan::build_flat_sources (cognitive 36) src/mito2/src/read/seq_scan.rs:683 — mito2::read::seq_scan::build_flat_sources has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 6, loops 4 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::region::opener::preload_parquet_meta_cache_for_files (cognitive 35) src/mito2/src/region/opener.rs:1285 — mito2::region::opener::preload_parquet_meta_cache_for_files has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (9 pts), boolean chains 3, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::sst::parquet::prefilter::build_reader_filter_plan (cognitive 35) src/mito2/src/sst/parquet/prefilter.rs:414 — mito2::sst::parquet::prefilter::build_reader_filter_plan has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 4, loops 2, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::read::scan_util::should_split_flat_batches_for_merge (cognitive 30) src/mito2/src/read/scan_util.rs:1257 — mito2::read::scan_util::should_split_flat_batches_for_merge has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::compaction::run::find_sorted_runs (cognitive 28) src/mito2/src/compaction/run.rs:262 — mito2::compaction::run::find_sorted_runs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 3 (7 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::memtable::bulk::part::convert_bulk_part (cognitive 28) src/mito2/src/memtable/bulk/part.rs:1045 — mito2::memtable::bulk::part::convert_bulk_part has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::compaction::run::find_overlapping_items (cognitive 27) src/mito2/src/compaction/run.rs:69 — mito2::compaction::run::find_overlapping_items has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::series_index::maintenance::build_index_version (cognitive 25) src/mito2/src/series_index/maintenance.rs:185 — mito2::series_index::maintenance::build_index_version has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (6 pts), boolean chains 3, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::sst::parquet::format::column_values_by_type (cognitive 25) src/mito2/src/sst/parquet/format.rs:150 — mito2::sst::parquet::format::column_values_by_type has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • mito2::read::scan_util::build_flat_file_range_scan_stream (cognitive 22) src/mito2/src/read/scan_util.rs:1576 — mito2::read::scan_util::build_flat_file_range_scan_stream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::read::series_reader::scan_series_file_ranges (cognitive 22) src/mito2/src/read/series_reader.rs:507 — mito2::read::series_reader::scan_series_file_ranges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::read::scan_region::exact_sequence_range (cognitive 21) src/mito2/src/read/scan_region.rs:1905 — mito2::read::scan_region::exact_sequence_range has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 6, match/switch 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::sst::index::column::json_index_target (cognitive 21) src/mito2/src/sst/index/column.rs:96 — mito2::sst::index::column::json_index_target has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • mito2::compaction::find_dynamic_options (cognitive 19) src/mito2/src/compaction.rs:58 — mito2::compaction::find_dynamic_options has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (19 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::compaction::twcs::units::close_units (cognitive 19) src/mito2/src/compaction/twcs/units.rs:907 — mito2::compaction::twcs::units::close_units has cognitive complexity 19 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • mito2::worker::handle_manifest::edit_region (cognitive 19) src/mito2/src/worker/handle_manifest.rs:1054 — mito2::worker::handle_manifest::edit_region has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::compaction::window::filter_time_windows (cognitive 18) src/mito2/src/compaction/window.rs:182 — mito2::compaction::window::filter_time_windows has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 3 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • mito2::series_index::builder::build_series_index (cognitive 18) src/mito2/src/series_index/builder.rs:127 — mito2::series_index::builder::build_series_index has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 4 (7 pts), match/switch 1 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::worker::handle_write::write_wal (cognitive 18) src/mito2/src/worker/handle_write.rs:689 — mito2::worker::handle_write::write_wal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::compaction::twcs::units::pick_closed_merge_candidates (cognitive 17) src/mito2/src/compaction/twcs/units.rs:329 — mito2::compaction::twcs::units::pick_closed_merge_candidates has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 8, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • mito2::sst::parquet::prefilter::build_prefilter_masks (cognitive 17) src/mito2/src/sst/parquet/prefilter.rs:1116 — mito2::sst::parquet::prefilter::build_prefilter_masks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 2 (6 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::sst::parquet::row_selection::intersect_row_selections (cognitive 16) src/mito2/src/sst/parquet/row_selection.rs:519 — mito2::sst::parquet::row_selection::intersect_row_selections has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • mito2::worker::handle_alter::log_time_index_widening_overflow (cognitive 16) src/mito2/src/worker/handle_alter.rs:634 — mito2::worker::handle_alter::log_time_index_widening_overflow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×23
  • Edited copy of a member (13 corresponding lines) src/common/function/src/scalars/geo/h3.rs:1322 — src/common/function/src/scalars/geo/h3.rs:1322-1334 | src/common/function/src/scalars/geo/h3.rs:1336-1348 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/datatypes/src/value.rs:330 — src/datatypes/src/value.rs:330-342 | src/datatypes/src/value.rs:356-371 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/object-store/src/config.rs:97 — src/object-store/src/config.rs:97-109 | src/object-store/src/config.rs:112-124 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/common/meta/src/key/topic_name.rs:213 — src/common/meta/src/key/topic_name.rs:213-226 | src/common/meta/src/key/topic_region.rs:215-227 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/index/src/bloom_filter/reader.rs:252 — src/index/src/bloom_filter/reader.rs:252-265 | src/index/src/inverted_index/format/reader/blob.rs:84-96 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:671 — REDACTED:671-687 | REDACTED:503-515 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/client/src/flow.rs:64 — src/client/src/flow.rs:64-77 | src/client/src/flow.rs:106-118 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/common/function/src/aggrs/approximate/uddsketch.rs:67 — src/common/function/src/aggrs/approximate/uddsketch.rs:67-79 | src/common/function/src/aggrs/approximate/uddsketch.rs:87-99 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/query/src/sql.rs:974 — src/query/src/sql.rs:974-988 | src/servers/src/mysql/federated.rs:168-180 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/common/meta/src/datanode.rs:470 — src/common/meta/src/datanode.rs:470-482 | src/meta-srv/src/key.rs:35-52 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py:178 — .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py:178-195 | .github/scripts/aliyun-ecs-runner-provision.py:270-282 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/mito2/src/series_index/writer.rs:296 — src/mito2/src/series_index/writer.rs:296-315 | src/mito2/src/sst/range_index/writer.rs:319-331 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/common/meta/src/ddl/drop_flow.rs:194 — src/common/meta/src/ddl/drop_flow.rs:194-207 | src/common/meta/src/ddl/drop_view.rs:186-198 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/store-api/src/region_request.rs:335 — src/store-api/src/region_request.rs:335-350 | src/store-api/src/region_request.rs:352-364 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/frontend/src/service_config/pending_rows_batcher.rs:64 — src/frontend/src/service_config/pending_rows_batcher.rs:64-76 | src/frontend/src/service_config/prom_store.rs:67-80 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/mito2/src/read/series_reader.rs:222 — src/mito2/src/read/series_reader.rs:222-235 | src/mito2/src/sst/parquet/prefilter.rs:245-257 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/servers/src/postgres/copy_in/options.rs:107 — src/servers/src/postgres/copy_in/options.rs:107-119 | src/servers/src/postgres/copy_in/options.rs:143-156 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/common/meta/src/key/schema_name.rs:199 — src/common/meta/src/key/schema_name.rs:199-211 | src/common/meta/src/key/table_name.rs:159-171 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/cli/src/metadata/snapshot.rs:73 — src/cli/src/metadata/snapshot.rs:73-85 | src/cli/src/metadata/snapshot.rs:132-146 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/datatypes/src/types/struct_type.rs:33 — src/datatypes/src/types/struct_type.rs:33-47 | src/mito2/src/memtable/time_series.rs:585-597 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/servers/src/prom_remote_write/v2.rs:928 — src/servers/src/prom_remote_write/v2.rs:928-940 | src/servers/src/prom_remote_write/v2.rs:1038-1053 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) src/promql/src/functions.rs:117 — src/promql/src/functions.rs:117-130 | src/promql/src/functions/extrapolate_rate.rs:459-471 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) tests-fuzz/src/translator/mysql/alter_expr.rs:58 — tests-fuzz/src/translator/mysql/alter_expr.rs:58-73 | tests-fuzz/src/translator/postgres/alter_expr.rs:54-66 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×23
  • Edited copy of a member (11 corresponding lines) src/catalog/src/system_schema/information_schema/flow_statistics.rs:260 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:260-270 | src/catalog/src/system_schema/information_schema/procedure_info.rs:217-227 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/common/function/src/aggrs/geo/encoding.rs:167 — src/common/function/src/aggrs/geo/encoding.rs:167-177 | src/common/function/src/aggrs/geo/geo_path.rs:196-206 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/servers/src/http/jaeger/v3.rs:272 — src/servers/src/http/jaeger/v3.rs:272-282 | src/servers/src/http/jaeger/v3.rs:382-394 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/mito2/src/memtable/bulk.rs:838 — src/mito2/src/memtable/bulk.rs:838-851 | src/mito2/src/memtable/time_series.rs:258-268 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/pipeline/src/manager/pipeline_cache.rs:82 — src/pipeline/src/manager/pipeline_cache.rs:82-92 | src/pipeline/src/manager/pipeline_cache.rs:101-115 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/servers/src/row_writer.rs:94 — src/servers/src/row_writer.rs:94-109 | src/servers/src/row_writer.rs:180-190 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/common/function/src/scalars/math/clamp.rs:261 — src/common/function/src/scalars/math/clamp.rs:261-271 | src/common/function/src/scalars/math/clamp.rs:315-325 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:111 — src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:111-124 | src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:126-136 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/mito-codec/src/key_values.rs:147 — src/mito-codec/src/key_values.rs:147-157 | src/mito-codec/src/key_values.rs:160-170 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/mito2/src/worker/handle_write.rs:273 — src/mito2/src/worker/handle_write.rs:273-288 | src/mito2/src/worker/handle_write.rs:764-774 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/mito2/src/sst/index/handler/builtin/bloom.rs:97 — src/mito2/src/sst/index/handler/builtin/bloom.rs:97-107 | src/mito2/src/sst/index/handler/builtin/fulltext.rs:107-120 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/datatypes/src/value.rs:1434 — src/datatypes/src/value.rs:1434-1444 | src/datatypes/src/value.rs:1446-1456 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/common/meta/src/key/flow/flow_route.rs:203 — src/common/meta/src/key/flow/flow_route.rs:203-214 | src/common/meta/src/key/flow/flownode_flow.rs:206-216 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/common/meta/src/key/tombstone.rs:417 — src/common/meta/src/key/tombstone.rs:417-427 | src/common/meta/src/key/tombstone.rs:469-479 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/servers/src/otlp/trace/v1.rs:293 — src/servers/src/otlp/trace/v1.rs:293-310 | src/servers/src/otlp/trace/v2.rs:120-130 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/mito-codec/src/row_converter/sparse.rs:282 — src/mito-codec/src/row_converter/sparse.rs:282-293 | src/mito-codec/src/row_converter/sparse.rs:312-322 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/servers/src/http.rs:1652 — src/servers/src/http.rs:1652-1662 | src/servers/src/grpc.rs:350-360 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/catalog/src/memory/manager.rs:83 — src/catalog/src/memory/manager.rs:83-97 | src/catalog/src/memory/manager.rs:118-128 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/log-store/src/kafka/log_store.rs:502 — src/log-store/src/kafka/log_store.rs:502-518 | src/log-store/src/raft_engine/log_store.rs:601-611 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/file-engine/src/error.rs:239 — src/file-engine/src/error.rs:239-250 | src/relational-engine/src/error.rs:170-180 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/common/meta/src/ddl/utils.rs:184 — src/common/meta/src/ddl/utils.rs:184-194 | src/common/meta/src/rpc/router.rs:77-87 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) src/file-engine/src/engine.rs:150 — src/file-engine/src/engine.rs:150-160 | src/relational-engine/src/engine.rs:127-137 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) tests-fuzz/targets/fuzz_insert.rs:112 — tests-fuzz/targets/fuzz_insert.rs:112-124 | tests-fuzz/targets/fuzz_insert_logical_table.rs:124-134 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×22
  • Edited copy of a member (15 corresponding lines) REDACTED:627 — REDACTED:627-646 | REDACTED:432-446 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/datatypes/src/json/value.rs:149 — src/datatypes/src/json/value.rs:149-163 | src/datatypes/src/json/value.rs:686-700 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/mito2/src/read/range_cache.rs:356 — src/mito2/src/read/range_cache.rs:356-371 | src/table/src/predicate.rs:449-463 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/mito2/src/read/flat_merge.rs:845 — src/mito2/src/read/flat_merge.rs:845-859 | src/mito2/src/read/flat_merge.rs:1020-1036 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/mito2/src/memtable/bulk/part.rs:189 — src/mito2/src/memtable/bulk/part.rs:189-203 | src/mito2/src/memtable/bulk/part.rs:1932-1946 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/mito2/src/read/range.rs:92 — src/mito2/src/read/range.rs:92-106 | src/mito2/src/read/range.rs:109-127 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) REDACTED:371 — REDACTED:371-387 | REDACTED:397-411 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/sql/src/parsers/alter_parser.rs:446 — src/sql/src/parsers/alter_parser.rs:446-460 | src/sql/src/parsers/alter_parser.rs:462-480 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/metric-engine/src/engine.rs:593 — src/metric-engine/src/engine.rs:593-607 | src/store-api/src/region_engine.rs:1105-1122 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/operator/src/statement/ddl.rs:2352 — src/operator/src/statement/ddl.rs:2352-2366 | src/operator/src/statement/ddl.rs:2406-2422 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/common/meta/src/ddl/alter_logical_tables.rs:215 — src/common/meta/src/ddl/alter_logical_tables.rs:215-231 | src/common/meta/src/ddl/alter_table.rs:428-442 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/datatypes/src/data_type.rs:177 — src/datatypes/src/data_type.rs:177-191 | src/datatypes/src/data_type.rs:203-217 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/common/meta/src/ddl/purge_dropped_table.rs:273 — src/common/meta/src/ddl/purge_dropped_table.rs:273-287 | src/common/meta/src/ddl/undrop_table.rs:465-479 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/datatypes/src/types/binary_type.rs:47 — src/datatypes/src/types/binary_type.rs:47-61 | src/datatypes/src/types/string_type.rs:51-65 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/mito2/src/read/flat_dedup.rs:143 — src/mito2/src/read/flat_dedup.rs:143-157 | src/mito2/src/read/flat_merge.rs:1087-1101 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/common/meta/src/key/catalog_name.rs:118 — src/common/meta/src/key/catalog_name.rs:118-132 | src/common/meta/src/key/schema_name.rs:232-246 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/datatypes/src/schema/constraint.rs:215 — src/datatypes/src/schema/constraint.rs:215-233 | src/datatypes/src/schema/constraint.rs:238-252 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/common/meta/src/ddl/alter_logical_tables/validator.rs:50 — src/common/meta/src/ddl/alter_logical_tables/validator.rs:50-64 | src/common/meta/src/reconciliation/reconcile_logical_tables/reconciliation_start.rs:155-169 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/frontend/src/events.rs:57 — src/frontend/src/events.rs:57-71 | src/meta-srv/src/event.rs:42-61 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/datanode/src/region_server.rs:951 — src/datanode/src/region_server.rs:951-965 | src/datanode/src/region_server.rs:971-987 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) src/meta-srv/src/procedure/region_migration/manager.rs:245 — src/meta-srv/src/procedure/region_migration/manager.rs:245-259 | src/meta-srv/src/procedure/region_migration/manager.rs:261-275 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) tests-fuzz/src/translator/mysql/repartition_expr.rs:81 — tests-fuzz/src/translator/mysql/repartition_expr.rs:81-95 | tests-fuzz/src/translator/mysql/select_expr.rs:24-43 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×21
  • Edited copy of a member (10 corresponding lines) src/mito2/src/read/seq_scan.rs:118 — src/mito2/src/read/seq_scan.rs:118-127 | src/mito2/src/read/series_scan.rs:446-455 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/datatypes/src/value.rs:1603 — src/datatypes/src/value.rs:1603-1612 | src/datatypes/src/value.rs:1671-1680 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:132 — src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:132-141 | src/common/meta/src/reconciliation/reconcile_database/reconcile_tables.rs:105-116 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/common/macro/src/row/attribute.rs:85 — src/common/macro/src/row/attribute.rs:85-94 | src/common/macro/src/row/attribute.rs:96-105 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/datatypes/src/value.rs:1624 — src/datatypes/src/value.rs:1624-1633 | src/datatypes/src/value.rs:1692-1701 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/partition/src/utils/split.rs:535 — src/partition/src/utils/split.rs:535-544 | tests-fuzz/src/ir/partition_expr.rs:213-225 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/puffin/src/blob_metadata.rs:73 — src/puffin/src/blob_metadata.rs:73-82 | src/puffin/src/file_metadata.rs:38-49 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/flow/src/adapter/flownode_impl.rs:714 — src/flow/src/adapter/flownode_impl.rs:714-728 | src/flow/src/adapter/flownode_impl.rs:730-739 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/log-store/src/raft_engine/backend.rs:436 — src/log-store/src/raft_engine/backend.rs:436-449 | src/log-store/src/raft_engine/backend.rs:451-460 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/mito2/src/series_index/writer.rs:392 — src/mito2/src/series_index/writer.rs:392-402 | src/mito2/src/sst/range_index/writer.rs:416-425 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/flow/src/batching_mode/utils.rs:235 — src/flow/src/batching_mode/utils.rs:235-244 | src/flow/src/batching_mode/utils.rs:1696-1705 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/mito2/src/region/version.rs:139 — src/mito2/src/region/version.rs:139-148 | src/mito2/src/region/version.rs:220-230 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/cli/src/data/export_v2/command.rs:466 — src/cli/src/data/export_v2/command.rs:466-475 | src/cli/src/data/import_v2/command.rs:176-185 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) REDACTED:108 — REDACTED:108-118 | REDACTED:105-114 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/datatypes/src/vectors/struct_vector.rs:44 — src/datatypes/src/vectors/struct_vector.rs:44-53 | src/datatypes/src/value.rs:1037-1046 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/promql/src/functions/native_histogram.rs:1102 — src/promql/src/functions/native_histogram.rs:1102-1111 | src/query/src/optimizer/const_normalization.rs:490-501 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/common/time/src/ttl.rs:54 — src/common/time/src/ttl.rs:54-64 | src/common/time/src/ttl.rs:131-140 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/common/function/src/aggrs/approximate/hll.rs:77 — src/common/function/src/aggrs/approximate/hll.rs:77-86 | src/common/function/src/aggrs/approximate/welford.rs:191-200 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/common/function/src/aggrs/approximate/hll.rs:92 — src/common/function/src/aggrs/approximate/hll.rs:92-101 | src/common/function/src/aggrs/approximate/welford.rs:203-212 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/meta-srv/src/procedure/region_migration.rs:215 — src/meta-srv/src/procedure/region_migration.rs:215-224 | src/meta-srv/src/procedure/region_migration/utils.rs:85-94 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) src/operator/src/expr_helper.rs:1218 — src/operator/src/expr_helper.rs:1218-1227 | src/operator/src/expr_helper/trigger.rs:105-114 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×21
  • Duplicated block (5 lines × 2) src/catalog/src/system_schema/information_schema/partitions.rs:323 — src/catalog/src/system_schema/information_schema/partitions.rs:323-328 | src/catalog/src/system_schema/information_schema/tables.rs:288-292 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/partitions.rs:323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/common/function/src/scalars/primary_key.rs:109 — src/common/function/src/scalars/primary_key.rs:109-113 | src/common/function/src/scalars/primary_key.rs:147-151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/primary_key.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/common/macro/src/admin_fn.rs:58 — src/common/macro/src/admin_fn.rs:58-62 | src/common/macro/src/range_fn.rs:44-48 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/macro/src/admin_fn.rs:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/common/meta/src/ddl/drop_table.rs:406 — src/common/meta/src/ddl/drop_table.rs:406-410 | src/common/meta/src/ddl/truncate_table.rs:81-85 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table.rs:406` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/common/meta/src/ddl/drop_table.rs:411` calls `into` and `src/common/meta/src/ddl/truncate_table.rs:86` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) src/common/meta/src/kv_backend/rds.rs:306 — src/common/meta/src/kv_backend/rds.rs:306-310 | src/common/meta/src/kv_backend/rds.rs:367-371 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/kv_backend/rds.rs:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/meta-srv/src/selector/round_robin.rs:69 — src/meta-srv/src/selector/round_robin.rs:69-73 | src/meta-srv/src/selector/round_robin.rs:83-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/selector/round_robin.rs:69` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) src/mito2/src/read.rs:596 — src/mito2/src/read.rs:596-600 | src/mito2/src/read.rs:670-674 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read.rs:596` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn merge_last_non_null(&mut` in one and `&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (5 lines × 2) src/query/src/datafusion.rs:85 — src/query/src/datafusion.rs:85-89 | src/query/src/datafusion.rs:114-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/datafusion.rs:85` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/query/src/promql/planner.rs:2299 — src/query/src/promql/planner.rs:2299-2303 | src/query/src/promql/planner.rs:3387-3391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) src/common/function/src/aggrs/approximate/avg.rs:80 — src/common/function/src/aggrs/approximate/avg.rs:80-84 | src/common/function/src/aggrs/approximate/welford.rs:262-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/common/function/src/aggrs/approximate/welford.rs:268` calls `decode_f64`, `from_bits`, `decode_u64` and `src/common/function/src/aggrs/approximate/avg.rs:86` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) src/common/meta/src/key/schema_name.rs:267 — src/common/meta/src/key/schema_name.rs:267-272 | src/common/meta/src/key/topic_region.rs:345-349 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) src/datanode/src/service.rs:52 — src/datanode/src/service.rs:52-56 | src/flow/src/server.rs:410-414 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) src/file-engine/src/engine.rs:255 — src/file-engine/src/engine.rs:255-259 | src/relational-engine/src/engine.rs:229-233 — before extracting anything, compare `src/file-engine/src/engine.rs` and `src/relational-engine/src/engine.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) src/servers/src/mysql/handler.rs:137 — src/servers/src/mysql/handler.rs:137-141 | src/servers/src/postgres/handler.rs:66-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) src/mito2/src/read/scan_region.rs:2147 — src/mito2/src/read/scan_region.rs:2147-2151 | src/mito2/src/read/scan_region.rs:2156-2162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/scan_region.rs:2147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/mito2/src/read/seq_scan.rs:634 — src/mito2/src/read/seq_scan.rs:634-638 | src/mito2/src/read/unordered_scan.rs:371-375 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/unordered_scan.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) src/operator/src/insert.rs:2149 — src/operator/src/insert.rs:2149-2153 | src/servers/src/otlp/logs.rs:956-960 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/insert.rs:2149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/partition/src/overlap.rs:147 — src/partition/src/overlap.rs:147-151 | src/partition/src/overlap.rs:162-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/partition/src/overlap.rs:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) src/store-api/src/region_info.rs:90 — src/store-api/src/region_info.rs:90-94 | src/store-api/src/sst_entry.rs:454-458 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) tests-fuzz/targets/ddl/fuzz_repartition_table.rs:176 — tests-fuzz/targets/ddl/fuzz_repartition_table.rs:176-180 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:327-331 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_repartition_table.rs` and `tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_repartition_table.rs:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) tests-fuzz/src/utils/network_chaos.rs:90 — tests-fuzz/src/utils/network_chaos.rs:90-94 | tests-fuzz/src/utils/pod_failure.rs:64-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/src/utils/network_chaos.rs:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D30 · Dependency Vulnerabilities · Medium vulnerability · ×20
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D1 · Cyclomatic Complexity · servers · ×18
  • servers::postgres::types::parameters_to_scalar_values (cyclomatic 131) src/servers/src/postgres/types.rs:574 — servers::postgres::types::parameters_to_scalar_values has cyclomatic complexity 131 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • servers::http::jaeger::traces_from_records (cyclomatic 64) src/servers/src/http/jaeger.rs:769 — servers::http::jaeger::traces_from_records has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::mysql::helper::convert_value (cyclomatic 49) src/servers/src/mysql/helper.rs:141 — servers::mysql::helper::convert_value has cyclomatic complexity 49 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • servers::otlp::metrics::prepare::prepare_metrics (cyclomatic 42) src/servers/src/otlp/metrics/prepare.rs:70 — servers::otlp::metrics::prepare::prepare_metrics has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::http::prom_store::exemplar::write (cyclomatic 28) src/servers/src/http/prom_store/exemplar.rs:46 — servers::http::prom_store::exemplar::write has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::batcher::table::pending_worker::start_worker (cyclomatic 19) src/servers/src/batcher/table/pending_worker.rs:64 — servers::batcher::table::pending_worker::start_worker has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::otlp::metrics::encode_histogram (cyclomatic 18) src/servers/src/otlp/metrics.rs:1157 — servers::otlp::metrics::encode_histogram has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::pipeline::run_custom_pipeline (cyclomatic 18) src/servers/src/pipeline.rs:99 — servers::pipeline::run_custom_pipeline has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • servers::postgres::handler::describe_fields (cyclomatic 18) src/servers/src/postgres/handler.rs:659 — servers::postgres::handler::describe_fields has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • servers::http::prometheus::update_metric_name_matcher (cyclomatic 17) src/servers/src/http/prometheus.rs:1788 — servers::http::prometheus::update_metric_name_matcher has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • servers::otlp::metrics::prepare::conflicting_points (cyclomatic 17) src/servers/src/otlp/metrics/prepare.rs:589 — servers::otlp::metrics::prepare::conflicting_points has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::postgres::copy_in::parse::scan_copy_from_stdin (cyclomatic 17) src/servers/src/postgres/copy_in/parse.rs:62 — servers::postgres::copy_in::parse::scan_copy_from_stdin has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • servers::prom_remote_write::v2::convert_remote_write_v2 (cyclomatic 17) src/servers/src/prom_remote_write/v2.rs:314 — servers::prom_remote_write::v2::convert_remote_write_v2 has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::http::handler::sql_analyze_stream (cyclomatic 16) src/servers/src/http/handler.rs:384 — servers::http::handler::sql_analyze_stream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::http::prometheus::collect_metric_names (cyclomatic 16) src/servers/src/http/prometheus.rs:1544 — servers::http::prometheus::collect_metric_names has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • servers::http::prometheus::label_values_query (cyclomatic 16) src/servers/src/http/prometheus.rs:1852 — servers::http::prometheus::label_values_query has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::otlp::trace::v1::write_attribute_with_schema (cyclomatic 16) src/servers/src/otlp/trace/v1.rs:606 — servers::otlp::trace::v1::write_attribute_with_schema has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • servers::prom_remote_write::v2::decode_series_leaves (cyclomatic 16) src/servers/src/prom_remote_write/v2.rs:724 — servers::prom_remote_write::v2::decode_series_leaves has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×18
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×17
  • Edited copy of a member (24 corresponding lines) src/servers/src/mysql/handler.rs:978 — src/servers/src/mysql/handler.rs:978-1004 | src/servers/src/mysql/handler.rs:1011-1034 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/common/function/src/scalars/vector.rs:123 — src/common/function/src/scalars/vector.rs:123-146 | src/common/function/src/scalars/vector.rs:212-237 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/datatypes/src/vectors/list.rs:345 — src/datatypes/src/vectors/list.rs:345-369 | src/datatypes/src/vectors/list.rs:372-395 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/log-store/src/raft_engine/backend.rs:289 — src/log-store/src/raft_engine/backend.rs:289-319 | src/log-store/src/raft_engine/backend.rs:373-396 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/log-store/src/raft_engine/log_store.rs:474 — src/log-store/src/raft_engine/log_store.rs:474-506 | src/log-store/src/raft_engine/log_store.rs:508-531 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/datatypes/src/arrow_array.rs:48 — src/datatypes/src/arrow_array.rs:48-71 | src/datatypes/src/arrow_array.rs:113-136 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/mito2/src/sst/index/fulltext_index/applier/builder.rs:202 — src/mito2/src/sst/index/fulltext_index/applier/builder.rs:202-225 | src/mito2/src/sst/index/fulltext_index/applier/builder.rs:230-260 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/common/time/src/date.rs:107 — src/common/time/src/date.rs:107-133 | src/common/time/src/timestamp.rs:371-394 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/operator/src/req_convert/insert/stmt_to_region.rs:204 — src/operator/src/req_convert/insert/stmt_to_region.rs:204-227 | src/session/src/table_name.rs:46-69 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/common/datasource/src/file_format/csv.rs:207 — src/common/datasource/src/file_format/csv.rs:207-230 | src/common/datasource/src/file_format/json.rs:130-153 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/common/meta/src/key/flow/flow_name.rs:114 — src/common/meta/src/key/flow/flow_name.rs:114-143 | src/common/meta/src/key/table_name.rs:72-95 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/mito2/src/sst/index/bloom_filter/applier/builder.rs:96 — src/mito2/src/sst/index/bloom_filter/applier/builder.rs:96-119 | src/mito2/src/sst/index/inverted_index/applier/builder.rs:132-156 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/servers/src/http/event.rs:1032 — src/servers/src/http/event.rs:1032-1055 | src/servers/src/http/splunk.rs:347-371 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) src/common/meta/src/kv_backend/test.rs:494 — src/common/meta/src/kv_backend/test.rs:494-517 | src/common/meta/src/kv_backend/test.rs:519-547 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:163 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:163-186 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:162-185 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) tests-fuzz/targets/fuzz_insert_logical_table.rs:207 — tests-fuzz/targets/fuzz_insert_logical_table.rs:207-232 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:284-307 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) tests-fuzz/src/utils/kafka_wal_http.rs:100 — tests-fuzz/src/utils/kafka_wal_http.rs:100-124 | tests-fuzz/src/utils/kafka_wal_http.rs:126-149 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×17
  • Edited copy of a member (18 corresponding lines) src/common/function/src/scalars/vector/scalar_add.rs:89 — src/common/function/src/scalars/vector/scalar_add.rs:89-106 | src/common/function/src/scalars/vector/scalar_mul.rs:89-106 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/frontend/src/instance.rs:353 — src/frontend/src/instance.rs:353-374 | src/frontend/src/instance.rs:829-846 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/meta/src/cluster.rs:229 — src/common/meta/src/cluster.rs:229-246 | src/meta-srv/src/key/datanode.rs:84-104 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/meta/src/key/flow/flow_route.rs:244 — src/common/meta/src/key/flow/flow_route.rs:244-261 | src/common/meta/src/key/flow/table_flow.rs:289-306 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/meta-srv/src/gc/procedure.rs:65 — src/meta-srv/src/gc/procedure.rs:65-83 | src/meta-srv/src/gc/procedure.rs:118-135 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/function/src/admin/reconcile_catalog.rs:107 — src/common/function/src/admin/reconcile_catalog.rs:107-124 | src/common/function/src/admin/reconcile_database.rs:116-134 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/datanode/src/greptimedb_telemetry.rs:58 — src/datanode/src/greptimedb_telemetry.rs:58-75 | src/meta-srv/src/greptimedb_telemetry.rs:63-82 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/sql/src/statements/tql.rs:99 — src/sql/src/statements/tql.rs:99-116 | src/sql/src/statements/tql.rs:134-151 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/recordbatch/src/recordbatch.rs:49 — src/common/recordbatch/src/recordbatch.rs:49-69 | src/common/recordbatch/src/recordbatch.rs:74-91 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/meta/src/ddl/drop_table.rs:337 — src/common/meta/src/ddl/drop_table.rs:337-354 | src/common/meta/src/ddl/drop_table.rs:442-465 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/meta-srv/src/handler/collect_cluster_info_handler.rs:48 — src/meta-srv/src/handler/collect_cluster_info_handler.rs:48-66 | src/meta-srv/src/handler/collect_cluster_info_handler.rs:82-99 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/cli/src/data/export_v2/data.rs:169 — src/cli/src/data/export_v2/data.rs:169-186 | src/cli/src/data/export_v2/data.rs:195-216 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/meta/src/rpc/ddl.rs:726 — src/common/meta/src/rpc/ddl.rs:726-743 | src/common/meta/src/rpc/ddl.rs:1007-1030 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/memory-manager/src/manager.rs:255 — src/common/memory-manager/src/manager.rs:255-272 | src/common/memory-manager/src/manager.rs:274-291 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/servers/src/otlp/trace/v1.rs:556 — src/servers/src/otlp/trace/v1.rs:556-573 | src/servers/src/otlp/trace/v1.rs:586-603 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/meta-srv/src/utils/mysql.rs:129 — src/meta-srv/src/utils/mysql.rs:129-149 | src/meta-srv/src/utils/postgres.rs:175-192 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) src/common/procedure/src/test_util.rs:40 — src/common/procedure/src/test_util.rs:40-57 | src/common/procedure/src/test_util.rs:59-78 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×17
  • Duplicated block (16 lines × 2) src/cli/src/metadata/control/put/table.rs:100 — src/cli/src/metadata/control/put/table.rs:100-115 | src/cli/src/metadata/control/put/table.rs:190-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) src/common/function/src/scalars/string/format.rs:68 — src/common/function/src/scalars/string/format.rs:68-83 | src/common/function/src/scalars/string/locate.rs:57-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/string/format.rs:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16 lines × 2) src/common/function/src/scalars/uddsketch_calc.rs:86 — src/common/function/src/scalars/uddsketch_calc.rs:86-101 | src/common/function/src/scalars/uddsketch_rank.rs:82-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) src/common/macro/src/row/into_row.rs:47 — src/common/macro/src/row/into_row.rs:47-62 | src/common/macro/src/row/to_row.rs:47-62 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/macro/src/row/into_row.rs:47` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) src/common/time/src/date.rs:112 — src/common/time/src/date.rs:112-127 | src/common/time/src/timestamp.rs:373-388 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (16 lines × 2) src/datatypes/src/vectors/dictionary.rs:326 — src/datatypes/src/vectors/dictionary.rs:326-341 | src/datatypes/src/vectors/dictionary.rs:360-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/datatypes/src/vectors/dictionary.rs:326` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) src/meta-client/src/client.rs:503 — src/meta-client/src/client.rs:503-518 | src/meta-client/src/client.rs:539-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-client/src/client.rs:503` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) src/mito2/src/read/compat.rs:446 — src/mito2/src/read/compat.rs:446-461 | src/mito2/src/read/compat.rs:607-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/compat.rs:446` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) src/mito2/src/sst/parquet/row_selection.rs:216 — src/mito2/src/sst/parquet/row_selection.rs:216-231 | src/mito2/src/sst/parquet/row_selection.rs:268-283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/parquet/row_selection.rs:216` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) src/sql/src/statements/tql.rs:101 — src/sql/src/statements/tql.rs:101-116 | src/sql/src/statements/tql.rs:136-151 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/statements/tql.rs:101` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) src/servers/src/http/authorize.rs:277 — src/servers/src/http/authorize.rs:277-292 | src/servers/src/http/authorize.rs:319-334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http/authorize.rs:319` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16 lines × 2) src/cmd/src/datanode/objbench.rs:492 — src/cmd/src/datanode/objbench.rs:492-507 | src/mito2/src/worker.rs:230-245 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) src/mito2/src/sst/index/fulltext_index/applier.rs:79 — src/mito2/src/sst/index/fulltext_index/applier.rs:79-94 | src/mito2/src/sst/parquet/reader.rs:1682-1697 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/fulltext_index/applier.rs:79` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:81 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:81-96 | tests-fuzz/targets/fuzz_insert_logical_table.rs:83-98 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:273 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:273-288 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:407-422 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 230 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:273` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:375 — tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:375-390 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:354-369 — before extracting anything, compare `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) tests-integration/src/test_util.rs:1225 — tests-integration/src/test_util.rs:1225-1240 | tests-integration/src/test_util.rs:1282-1297 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tests-integration/src/test_util.rs:1225` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tests-integration/src/test_util.rs:1223` calls `fe_instance`, `clone` and `tests-integration/src/test_util.rs:1279` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D17 · Explicit Debt · FixmeComment · ×16
  • FixmeComment tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs:167 — // FIXME(weny): support to retry it later. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment tests-fuzz/src/ir.rs:111 — /// FIXME(weny): Waits for https://github.com/GreptimeTeam/greptimedb/issues/4247
  • FixmeComment src/store-api/src/storage/descriptors.rs:53 — /// FIXME(discord9): workaround for serde issue: https://github.com/serde-rs/json/issues/1254
  • FixmeComment src/servers/src/http.rs:1689 — // FIXME(yingwen): Support keepalive. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/query/src/promql/planner/function_plans.rs:147 — // FIXME(ruihang): support multi fields — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/query/src/optimizer/json_type_concretize.rs:71 — // FIXME: `json_types` is keyed only by unqualified column name. In joins with — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/query/src/dist_plan/analyzer.rs:286 — // FIXME(yingwen): Remove the `Limit` plan once we update DataFusion. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/query/src/dist_plan/analyzer/test.rs:786 — /// FIXME(discord9): alias to same name with col req makes it ambiguous — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/mito2/src/config.rs:294 — // FIXME(#9435): Keep v2 opt-in while long-range scan memory usage is investigated.
  • FixmeComment src/mito2/src/sst/index/handler/builtin/inverted.rs:137 — // FIXME: Rebuilds replace the whole Puffin file and can drop existing JSON path indexes. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/mito2/src/sst/index/fulltext_index/creator.rs:203 — // FIXME: Rebuilds replace the whole Puffin file and can drop existing JSON path indexes. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/mito2/src/sst/index/bloom_filter/creator.rs:175 — // FIXME: Rebuilds replace the whole Puffin file and can drop existing JSON path indexes. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/common/time/src/date.rs:139 — // FIXME(yingwen): remove add/sub intervals later — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/common/time/src/timestamp.rs:144 — // FIXME(yingwen): remove add/sub intervals later — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/common/meta/src/key/datanode_table.rs:246 — // FIXME(weny): Before we store all region wal options into table metadata or somewhere, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/common/meta/src/key/datanode_table.rs:344 — // FIXME(weny): add unit tests. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×16
  • Edited copy of a member (12 corresponding lines) src/common/query/src/request.rs:237 — src/common/query/src/request.rs:237-249 | src/common/query/src/request.rs:702-713 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/mito2/src/series_index/writer.rs:404 — src/mito2/src/series_index/writer.rs:404-415 | src/mito2/src/sst/range_index/writer.rs:427-438 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/cli/src/data/import_v2/state.rs:262 — src/cli/src/data/import_v2/state.rs:262-275 | src/cli/src/data/import_v2/state.rs:373-384 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/common/meta/src/rpc/ddl.rs:548 — src/common/meta/src/rpc/ddl.rs:548-559 | src/common/meta/src/rpc/ddl.rs:852-864 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/object-store/src/secure_fs.rs:91 — src/object-store/src/secure_fs.rs:91-102 | src/object-store/src/secure_fs.rs:105-117 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) REDACTED:658 — REDACTED:658-669 | REDACTED:490-501 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/operator/src/req_convert/common/partitioner.rs:388 — src/operator/src/req_convert/common/partitioner.rs:388-400 | src/operator/src/req_convert/common/partitioner.rs:403-414 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/puffin/src/file_format/writer/file.rs:158 — src/puffin/src/file_format/writer/file.rs:158-169 | src/puffin/src/file_format/writer/file.rs:181-192 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/common/meta/src/kv_backend/rds/mysql.rs:309 — src/common/meta/src/kv_backend/rds/mysql.rs:309-320 | src/common/meta/src/kv_backend/rds/mysql.rs:322-333 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/common/function/src/uddsketch_compat.rs:82 — src/common/function/src/uddsketch_compat.rs:82-93 | src/common/function/src/uddsketch_compat.rs:95-106 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/datanode/src/region_server/catalog.rs:90 — src/datanode/src/region_server/catalog.rs:90-101 | src/datanode/src/region_server/catalog.rs:104-115 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/sql/src/statements/show.rs:69 — src/sql/src/statements/show.rs:69-80 | src/sql/src/statements/show.rs:152-164 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/meta-srv/src/procedure/repartition.rs:812 — src/meta-srv/src/procedure/repartition.rs:812-824 | src/meta-srv/src/procedure/repartition/group.rs:265-276 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/common/meta/src/reconciliation/reconcile_logical_tables/reconciliation_end.rs:34 — src/common/meta/src/reconciliation/reconcile_logical_tables/reconciliation_end.rs:34-48 | src/common/meta/src/reconciliation/reconcile_table/reconciliation_end.rs:35-46 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/meta-srv/src/utils/database.rs:70 — src/meta-srv/src/utils/database.rs:70-81 | src/meta-srv/src/utils/database.rs:88-99 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) src/mito2/src/read/seq_scan.rs:521 — src/mito2/src/read/seq_scan.rs:521-536 | src/mito2/src/read/unordered_scan.rs:196-207 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×16
  • Duplicated block (15 lines × 2) src/cli/src/data/export.rs:216 — src/cli/src/data/export.rs:216-230 | src/cli/src/data/import.rs:197-211 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) src/common/datasource/src/file_format/csv.rs:163 — src/common/datasource/src/file_format/csv.rs:163-177 | src/common/datasource/src/file_format/json.rs:91-105 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) src/common/function/src/scalars/anomaly/iqr.rs:119 — src/common/function/src/scalars/anomaly/iqr.rs:119-133 | src/common/function/src/scalars/anomaly/mad.rs:109-123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/anomaly/iqr.rs:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/common/meta/src/ddl/drop_table/executor.rs:323 — src/common/meta/src/ddl/drop_table/executor.rs:323-337 | src/common/meta/src/ddl/drop_table/executor.rs:440-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table/executor.rs:323` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:73 — src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:73-87 | src/common/meta/src/reconciliation/reconcile_database/reconcile_tables.rs:65-79 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/common/meta/src/reconciliation/reconcile_table/resolve_column_metadata.rs:139 — src/common/meta/src/reconciliation/reconcile_table/resolve_column_metadata.rs:139-153 | src/common/meta/src/reconciliation/reconcile_table/resolve_column_metadata.rs:158-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/reconciliation/reconcile_table/resolve_column_metadata.rs:139` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/mito2/src/read/flat_merge.rs:863 — src/mito2/src/read/flat_merge.rs:863-877 | src/mito2/src/read/flat_merge.rs:1040-1054 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) src/pipeline/src/etl/processor/decolorize.rs:116 — src/pipeline/src/etl/processor/decolorize.rs:116-130 | src/pipeline/src/etl/processor/digest.rs:212-226 — before extracting anything, compare `src/pipeline/src/etl/processor/decolorize.rs` and `src/pipeline/src/etl/processor/digest.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/decolorize.rs:116` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/promql/src/extension_plan/range_manipulate.rs:590 — src/promql/src/extension_plan/range_manipulate.rs:590-604 | src/promql/src/extension_plan/scalar_calculate.rs:496-510 — before extracting anything, compare `src/promql/src/extension_plan/range_manipulate.rs` and `src/promql/src/extension_plan/scalar_calculate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/range_manipulate.rs:590` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/query/src/promql/planner.rs:1835 — src/query/src/promql/planner.rs:1835-1849 | src/query/src/promql/planner.rs:1858-1872 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:1835` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/servers/src/postgres/types.rs:1216 — src/servers/src/postgres/types.rs:1216-1230 | src/servers/src/postgres/types.rs:1285-1299 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:1285` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/servers/src/postgres/types.rs:1328 — src/servers/src/postgres/types.rs:1328-1342 | src/servers/src/postgres/types.rs:1388-1402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:1388` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/sql/src/parsers/alter_parser/trigger.rs:95 — src/sql/src/parsers/alter_parser/trigger.rs:95-109 | src/sql/src/parsers/alter_parser/trigger.rs:114-128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) src/sql/src/parsers/create_parser/trigger.rs:297 — src/sql/src/parsers/create_parser/trigger.rs:297-311 | src/sql/src/parsers/create_parser/trigger.rs:352-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/create_parser/trigger.rs:297` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) src/frontend/src/instance/otlp/trace_ingest.rs:1528 — src/frontend/src/instance/otlp/trace_ingest.rs:1528-1542 | src/frontend/src/instance/otlp/trace_ingest.rs:1598-1613 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/otlp/trace_ingest.rs:1528` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15 lines × 2) .github/scripts/aliyun-ecs-runner-provision.py:248 — .github/scripts/aliyun-ecs-runner-provision.py:248-262 | .github/scripts/aliyun-ecs-runner-teardown.py:108-122 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `.github/scripts/aliyun-ecs-runner-provision.py:248` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×16
  • Duplicated block (14 lines × 2) src/catalog/src/kvbackend/client.rs:237 — src/catalog/src/kvbackend/client.rs:237-250 | src/catalog/src/kvbackend/client.rs:257-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/kvbackend/client.rs:237` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/common/function/src/scalars/geo/h3.rs:1213 — src/common/function/src/scalars/geo/h3.rs:1213-1226 | src/common/function/src/scalars/geo/h3.rs:1279-1292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:1213` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/common/function/src/scalars/ip/range.rs:220 — src/common/function/src/scalars/ip/range.rs:220-233 | src/common/function/src/scalars/ip/range.rs:256-269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/ip/range.rs:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) REDACTED:946 — REDACTED:946-959 | REDACTED:789-802 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) src/mito2/src/engine.rs:1013 — src/mito2/src/engine.rs:1013-1026 | src/mito2/src/engine.rs:1129-1142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine.rs:1013` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/mito2/src/engine.rs:1771 — src/mito2/src/engine.rs:1771-1784 | src/mito2/src/engine.rs:1791-1804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/engine.rs:1771` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/mito2/src/sst/parquet/file_range.rs:337 — src/mito2/src/sst/parquet/file_range.rs:337-350 | src/mito2/src/sst/parquet/file_range.rs:371-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/parquet/file_range.rs:337` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/operator/src/expr_helper.rs:1139 — src/operator/src/expr_helper.rs:1139-1152 | src/operator/src/expr_helper.rs:1169-1182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/expr_helper.rs:1139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/operator/src/write_dispatcher.rs:557 — src/operator/src/write_dispatcher.rs:557-570 | src/operator/src/write_dispatcher/progress.rs:196-209 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/write_dispatcher.rs:557` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) src/query/src/range_select/plan.rs:603 — src/query/src/range_select/plan.rs:603-616 | src/query/src/range_select/plan.rs:649-662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/range_select/plan.rs:603` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/servers/src/http.rs:1347 — src/servers/src/http.rs:1347-1360 | src/servers/src/http.rs:1382-1395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http.rs:1347` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/servers/src/http.rs:1364` calls `route`, `post` and `src/servers/src/http.rs:1399` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) src/store-api/src/metadata.rs:936 — src/store-api/src/metadata.rs:936-949 | src/store-api/src/metadata.rs:977-990 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/store-api/src/metadata.rs:936` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/common/function/src/scalars/geo/geohash.rs:117 — src/common/function/src/scalars/geo/geohash.rs:117-130 | src/common/function/src/scalars/geo/h3.rs:1019-1032 — before extracting anything, compare `src/common/function/src/scalars/geo/geohash.rs` and `src/common/function/src/scalars/geo/h3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/geohash.rs:117` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/mito2/src/memtable/time_partition.rs:589 — src/mito2/src/memtable/time_partition.rs:589-602 | src/mito2/src/memtable/time_partition.rs:641-654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/memtable/time_partition.rs:589` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) src/meta-client/src/client/config.rs:93 — src/meta-client/src/client/config.rs:93-106 | src/meta-client/src/client/heartbeat.rs:218-231 — before extracting anything, compare `src/meta-client/src/client/config.rs` and `src/meta-client/src/client/heartbeat.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-client/src/client/config.rs:93` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) tests-fuzz/targets/ddl/fuzz_repartition_table.rs:101 — tests-fuzz/targets/ddl/fuzz_repartition_table.rs:101-114 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:132-145 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_repartition_table.rs` and `tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D2 · Cognitive Complexity · RegionWorkerLoop · ×15
  • RegionWorkerLoop::run (cognitive 40) src/mito2/src/worker.rs:1291 — RegionWorkerLoop::run has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 5 (13 pts), loops 3 (7 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::process_write_requests (cognitive 39) src/mito2/src/worker/handle_write.rs:307 — RegionWorkerLoop::process_write_requests has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (34 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::process_bulk_requests (cognitive 38) src/mito2/src/worker/handle_write.rs:485 — RegionWorkerLoop::process_bulk_requests has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (34 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::handle_alter_region_options_fast (cognitive 29) src/mito2/src/worker/handle_alter.rs:234 — RegionWorkerLoop::handle_alter_region_options_fast has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (26 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::handle_region_edit (cognitive 23) src/mito2/src/worker/handle_manifest.rs:348 — RegionWorkerLoop::handle_region_edit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 7, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RegionWorkerLoop::handle_write_requests (cognitive 23) src/mito2/src/worker/handle_write.rs:46 — RegionWorkerLoop::handle_write_requests has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • RegionWorkerLoop::execute_alter_request (cognitive 22) src/mito2/src/worker/handle_alter.rs:49 — RegionWorkerLoop::execute_alter_request has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::maybe_flush_write_regions (cognitive 20) src/mito2/src/worker/handle_flush.rs:212 — RegionWorkerLoop::maybe_flush_write_regions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::handle_truncate_request (cognitive 20) src/mito2/src/worker/handle_truncate.rs:29 — RegionWorkerLoop::handle_truncate_request has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (5 pts), match/switch 4, boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::handle_rebuild_index (cognitive 19) src/mito2/src/worker/handle_rebuild_index.rs:167 — RegionWorkerLoop::handle_rebuild_index has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • RegionWorkerLoop::handle_catchup_request (cognitive 18) src/mito2/src/worker/handle_catchup.rs:38 — RegionWorkerLoop::handle_catchup_request has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::handle_region_edit_result (cognitive 18) src/mito2/src/worker/handle_manifest.rs:506 — RegionWorkerLoop::handle_region_edit_result has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, match/switch 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::dispatch_pending_region_requests (cognitive 17) src/mito2/src/worker/handle_manifest.rs:715 — RegionWorkerLoop::dispatch_pending_region_requests has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionWorkerLoop::handle_open_request (cognitive 17) src/mito2/src/worker/handle_open.rs:162 — RegionWorkerLoop::handle_open_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (5 pts), match/switch 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • RegionWorkerLoop::handle_compaction_unit (cognitive 16) src/mito2/src/worker/handle_compaction.rs:39 — RegionWorkerLoop::handle_compaction_unit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×15
  • Edited copy of a member (20 corresponding lines) src/datatypes/src/vectors/dictionary.rs:322 — src/datatypes/src/vectors/dictionary.rs:322-341 | src/datatypes/src/vectors/dictionary.rs:356-375 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/common/function/src/scalars/json/json_to_string.rs:67 — src/common/function/src/scalars/json/json_to_string.rs:67-86 | src/common/function/src/scalars/json/parse_json.rs:58-79 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/promql/src/extension_plan/range_manipulate.rs:585 — src/promql/src/extension_plan/range_manipulate.rs:585-604 | src/promql/src/extension_plan/scalar_calculate.rs:491-510 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/catalog/src/memory/manager.rs:324 — src/catalog/src/memory/manager.rs:324-343 | src/catalog/src/memory/manager.rs:367-391 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/query/src/datafusion.rs:83 — src/query/src/datafusion.rs:83-102 | src/query/src/datafusion.rs:112-139 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/mito2/src/series_index/writer.rs:189 — src/mito2/src/series_index/writer.rs:189-208 | src/mito2/src/sst/range_index/writer.rs:182-201 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/servers/src/postgres/handler.rs:198 — src/servers/src/postgres/handler.rs:198-220 | src/servers/src/postgres/handler.rs:266-285 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/query/src/optimizer/remove_duplicate.rs:37 — src/query/src/optimizer/remove_duplicate.rs:37-58 | src/query/src/optimizer/windowed_sort.rs:347-366 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/common/meta/src/key/flow/flow_info.rs:108 — src/common/meta/src/key/flow/flow_info.rs:108-127 | src/common/meta/src/key/flow/flow_route.rs:115-139 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/operator/src/delete.rs:231 — src/operator/src/delete.rs:231-250 | src/operator/src/insert.rs:2177-2196 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/query/src/sql.rs:194 — src/query/src/sql.rs:194-221 | src/query/src/sql.rs:1191-1210 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/common/meta/src/ddl/alter_logical_tables.rs:294 — src/common/meta/src/ddl/alter_logical_tables.rs:294-320 | src/common/meta/src/ddl/alter_table.rs:614-633 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/common/meta/src/kv_backend/etcd.rs:125 — src/common/meta/src/kv_backend/etcd.rs:125-144 | src/common/meta/src/kv_backend/etcd.rs:214-233 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) src/mito2/src/sst/index/bloom_filter/applier.rs:159 — src/mito2/src/sst/index/bloom_filter/applier.rs:159-178 | src/mito2/src/sst/index/inverted_index/applier.rs:170-192 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:434 — tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:434-456 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:290-309 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×15
  • Edited copy of a member (16 corresponding lines) src/common/meta/src/key.rs:617 — src/common/meta/src/key.rs:617-632 | src/common/meta/src/key.rs:638-656 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/datatypes/src/vectors/binary.rs:441 — src/datatypes/src/vectors/binary.rs:441-456 | src/datatypes/src/vectors/string.rs:495-514 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/promql/src/extension_plan/empty_metric.rs:206 — src/promql/src/extension_plan/empty_metric.rs:206-221 | src/promql/src/extension_plan/union_distinct_on.rs:242-260 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/query/src/query_engine/default_serializer.rs:213 — src/query/src/query_engine/default_serializer.rs:213-229 | src/query/src/query_engine/default_serializer.rs:232-247 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/client/src/database.rs:667 — src/client/src/database.rs:667-682 | src/client/src/database.rs:694-709 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/mito2/src/wal/encoder.rs:237 — src/mito2/src/wal/encoder.rs:237-255 | src/mito2/src/wal/encoder.rs:287-302 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/partition/src/simplify.rs:244 — src/partition/src/simplify.rs:244-259 | src/partition/src/simplify.rs:261-276 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/cli/src/data/export_v2/extractor.rs:187 — src/cli/src/data/export_v2/extractor.rs:187-202 | src/cli/src/data/import_v2/command.rs:566-588 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/cli/src/data/import_v2/coordinator.rs:514 — src/cli/src/data/import_v2/coordinator.rs:514-529 | src/cli/src/data/import_v2/coordinator.rs:531-546 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) REDACTED:268 — REDACTED:268-283 | REDACTED:289-304 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/mito2/src/sst/parquet/row_selection.rs:595 — src/mito2/src/sst/parquet/row_selection.rs:595-610 | src/mito2/src/sst/parquet/row_selection.rs:619-640 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/mito2/src/read/seq_scan.rs:654 — src/mito2/src/read/seq_scan.rs:654-670 | src/mito2/src/read/unordered_scan.rs:391-406 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/mito2/src/series_index/writer.rs:211 — src/mito2/src/series_index/writer.rs:211-226 | src/mito2/src/sst/range_index/writer.rs:204-219 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/puffin/src/file_format/writer/file.rs:80 — src/puffin/src/file_format/writer/file.rs:80-95 | src/puffin/src/file_format/writer/file.rs:116-133 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) src/client/src/database.rs:482 — src/client/src/database.rs:482-499 | src/client/src/region.rs:348-363 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×15
  • Edited copy of a member (17 corresponding lines) src/mito2/src/region/version.rs:201 — src/mito2/src/region/version.rs:201-217 | src/mito2/src/region/version.rs:241-258 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/query/src/promql/planner.rs:4894 — src/query/src/promql/planner.rs:4894-4914 | src/query/src/promql/planner.rs:4920-4936 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/meta-srv/src/procedure/region_migration/manager.rs:209 — src/meta-srv/src/procedure/region_migration/manager.rs:209-225 | src/meta-srv/src/procedure/wal_prune/manager.rs:146-165 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/mito2/src/read/range.rs:307 — src/mito2/src/read/range.rs:307-324 | src/mito2/src/read/range.rs:327-343 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/meta-client/src/client/util.rs:71 — src/meta-client/src/client/util.rs:71-87 | src/meta-client/src/client/util.rs:94-110 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) REDACTED:508 — REDACTED:508-524 | REDACTED:339-359 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/common/meta/src/key/flow/flownode_addr_helper.rs:28 — src/common/meta/src/key/flow/flownode_addr_helper.rs:28-47 | src/common/meta/src/key/table_route.rs:816-832 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/mito2/src/memtable/simple_bulk_memtable.rs:74 — src/mito2/src/memtable/simple_bulk_memtable.rs:74-90 | src/mito2/src/memtable/time_series.rs:238-255 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) .github/scripts/query-regression-nightly-refs.py:192 — .github/scripts/query-regression-nightly-refs.py:192-208 | .github/scripts/query-regression-slash.py:469-488 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/index/src/bloom_filter/reader.rs:229 — src/index/src/bloom_filter/reader.rs:229-246 | src/index/src/inverted_index/format/reader/blob.rs:62-78 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/operator/src/req_convert/insert/stmt_to_region.rs:78 — src/operator/src/req_convert/insert/stmt_to_region.rs:78-94 | src/operator/src/req_convert/insert/table_to_region.rs:62-79 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/servers/src/grpc.rs:153 — src/servers/src/grpc.rs:153-169 | src/servers/src/grpc.rs:176-192 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/datatypes/src/schema/column_schema.rs:316 — src/datatypes/src/schema/column_schema.rs:316-333 | src/datatypes/src/schema/column_schema.rs:359-375 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/catalog/src/information_extension.rs:221 — src/catalog/src/information_extension.rs:221-237 | src/common/query/src/stream.rs:59-77 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) src/cli/src/data/export_v2/manifest.rs:370 — src/cli/src/data/export_v2/manifest.rs:370-386 | src/cli/src/data/export_v2/manifest.rs:394-410 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×15
  • Edited copy of a member (8 corresponding lines) src/common/recordbatch/src/filter/timestamp.rs:26 — src/common/recordbatch/src/filter/timestamp.rs:26-33 | src/query/src/promql/label_values.rs:65-73 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/mito2/src/sst/index/bloom_filter/applier/builder.rs:326 — src/mito2/src/sst/index/bloom_filter/applier/builder.rs:326-333 | src/mito2/src/sst/index/inverted_index/applier/builder.rs:268-275 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/api/src/v1/column_def.rs:222 — src/api/src/v1/column_def.rs:222-229 | src/api/src/v1/column_def.rs:232-241 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/common/mem-prof/src/jemalloc.rs:90 — src/common/mem-prof/src/jemalloc.rs:90-97 | src/common/mem-prof/src/jemalloc.rs:143-155 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/meta-srv/src/handler.rs:843 — src/meta-srv/src/handler.rs:843-850 | src/meta-srv/src/handler.rs:861-868 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/store-api/src/compaction_task.rs:197 — src/store-api/src/compaction_task.rs:197-204 | src/store-api/src/sst_entry.rs:177-184 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/flow/src/batching_mode/state.rs:558 — src/flow/src/batching_mode/state.rs:558-567 | src/store-api/src/storage/types.rs:43-50 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/mito2/src/sst/index/store.rs:187 — src/mito2/src/sst/index/store.rs:187-194 | src/mito2/src/sst/index/store.rs:243-250 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/common/meta/src/key/table_repart.rs:251 — src/common/meta/src/key/table_repart.rs:251-258 | src/common/meta/src/key/table_route.rs:709-716 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/common/meta/src/key.rs:1314 — src/common/meta/src/key.rs:1314-1322 | src/common/meta/src/key/flow.rs:459-466 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/sql/src/statements/drop.rs:120 — src/sql/src/statements/drop.rs:120-127 | src/sql/src/statements/drop/trigger.rs:43-50 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/mito2/src/memtable/bulk.rs:854 — src/mito2/src/memtable/bulk.rs:854-861 | src/mito2/src/memtable/time_partition.rs:489-496 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/catalog/src/system_schema/information_schema/flow_statistics.rs:101 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:101-108 | src/catalog/src/system_schema/information_schema/flows.rs:188-195 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) src/api/src/v1/helper.rs:45 — src/api/src/v1/helper.rs:45-52 | src/servers/src/row_writer.rs:162-173 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) tests-fuzz/src/translator/mysql/create_expr.rs:49 — tests-fuzz/src/translator/mysql/create_expr.rs:49-59 | tests-fuzz/src/translator/postgres/create_expr.rs:48-55 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×15
  • Edited copy of a member (7 corresponding lines) src/common/function/src/aggrs/approximate/avg.rs:48 — src/common/function/src/aggrs/approximate/avg.rs:48-54 | src/common/function/src/aggrs/approximate/welford.rs:55-62 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/servers/src/http/prometheus.rs:593 — src/servers/src/http/prometheus.rs:593-599 | src/servers/src/http/prometheus.rs:735-750 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/mito2/src/worker/handle_write.rs:208 — src/mito2/src/worker/handle_write.rs:208-214 | src/mito2/src/worker/handle_write.rs:254-261 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/query/src/parser.rs:280 — src/query/src/parser.rs:280-305 | src/query/src/parser.rs:337-346 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/operator/src/statement/export_logical_tables/writers.rs:60 — src/operator/src/statement/export_logical_tables/writers.rs:60-66 | src/operator/src/statement/export_logical_tables/writers.rs:72-84 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/datatypes/src/schema.rs:240 — src/datatypes/src/schema.rs:240-249 | src/datatypes/src/schema/column_schema.rs:635-641 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) .github/scripts/aws-ec2-runner-provision.py:42 — .github/scripts/aws-ec2-runner-provision.py:42-48 | .github/scripts/metric-snapshot-s3-ops.py:82-88 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/common/frontend/src/metrics.rs:68 — src/common/frontend/src/metrics.rs:68-74 | src/mito2/src/cache.rs:1824-1831 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/flow/src/batching_mode/task.rs:253 — src/flow/src/batching_mode/task.rs:253-260 | tests-fuzz/src/ir.rs:629-635 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/store-api/src/region_request.rs:882 — src/store-api/src/region_request.rs:882-888 | src/table/src/requests.rs:769-775 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/sql/src/parsers/create_parser.rs:75 — src/sql/src/parsers/create_parser.rs:75-81 | src/sql/src/statements/option_map.rs:214-220 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/file-engine/src/engine.rs:228 — src/file-engine/src/engine.rs:228-235 | src/relational-engine/src/engine.rs:203-209 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/meta-srv/src/procedure/repartition/group/repartition_end.rs:34 — src/meta-srv/src/procedure/repartition/group/repartition_end.rs:34-40 | src/meta-srv/src/procedure/repartition/repartition_end.rs:34-40 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) src/meta-srv/src/procedure/region_migration.rs:203 — src/meta-srv/src/procedure/region_migration.rs:203-210 | src/meta-srv/src/region/flush_trigger.rs:586-592 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) tests-fuzz/src/translator/mysql/alter_expr.rs:108 — tests-fuzz/src/translator/mysql/alter_expr.rs:108-114 | tests-fuzz/src/translator/postgres/alter_expr.rs:104-111 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×14
  • Edited copy of a member (22 corresponding lines) src/datanode/src/service.rs:65 — src/datanode/src/service.rs:65-89 | src/flow/src/server.rs:416-437 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/sql/src/statements/copy.rs:69 — src/sql/src/statements/copy.rs:69-90 | src/sql/src/statements/copy.rs:100-121 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/mito2/src/read/seq_scan.rs:87 — src/mito2/src/read/seq_scan.rs:87-108 | src/mito2/src/read/unordered_scan.rs:64-86 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/mito2/src/sst/index/column.rs:175 — src/mito2/src/sst/index/column.rs:175-196 | src/mito2/src/sst/index/inverted_index/applier.rs:449-470 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/common/datasource/src/file_format.rs:310 — src/common/datasource/src/file_format.rs:310-331 | src/file-engine/src/query/file_stream.rs:52-78 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/query/src/promql/planner.rs:1828 — src/query/src/promql/planner.rs:1828-1849 | src/query/src/promql/planner.rs:1851-1872 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/sql/src/statements/alter/trigger.rs:130 — src/sql/src/statements/alter/trigger.rs:130-151 | src/sql/src/statements/alter/trigger.rs:180-201 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/catalog/src/system_schema/information_schema/key_column_usage.rs:305 — src/catalog/src/system_schema/information_schema/key_column_usage.rs:305-332 | src/catalog/src/system_schema/information_schema/views.rs:238-259 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/common/meta/src/ddl/create_flow.rs:597 — src/common/meta/src/ddl/create_flow.rs:597-618 | src/flow/src/batching_mode/eval_schedule.rs:305-326 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/mito2/src/memtable/bulk/part_reader.rs:191 — src/mito2/src/memtable/bulk/part_reader.rs:191-212 | src/mito2/src/memtable/bulk/part_reader.rs:352-373 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/common/grpc/src/flight.rs:46 — src/common/grpc/src/flight.rs:46-67 | src/metric-engine/src/engine/bulk_insert.rs:205-230 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/common/meta/src/kv_backend/etcd.rs:301 — src/common/meta/src/kv_backend/etcd.rs:301-326 | src/common/meta/src/kv_backend/etcd.rs:432-453 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) src/query/src/sql.rs:1218 — src/query/src/sql.rs:1218-1249 | src/query/src/sql.rs:1257-1278 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:235 — tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:235-256 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:496-521 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×14
  • Edited copy of a member (19 corresponding lines) src/common/meta/src/ddl/drop_table.rs:418 — src/common/meta/src/ddl/drop_table.rs:418-436 | src/common/meta/src/ddl/truncate_table.rs:92-110 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/store-api/src/region_engine.rs:1029 — src/store-api/src/region_engine.rs:1029-1047 | src/store-api/src/region_engine.rs:1053-1071 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/common/function/src/scalars/primary_key.rs:108 — src/common/function/src/scalars/primary_key.rs:108-131 | src/common/function/src/scalars/primary_key.rs:146-164 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/store-api/src/metadata.rs:891 — src/store-api/src/metadata.rs:891-909 | src/store-api/src/metadata.rs:911-929 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/mito2/src/cache/file_cache.rs:632 — src/mito2/src/cache/file_cache.rs:632-650 | src/mito2/src/cache/file_cache.rs:659-677 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/promql/src/extension_plan/normalize.rs:248 — src/promql/src/extension_plan/normalize.rs:248-268 | src/promql/src/extension_plan/series_divide.rs:312-330 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/catalog/src/kvbackend/client.rs:232 — src/catalog/src/kvbackend/client.rs:232-250 | src/catalog/src/kvbackend/client.rs:252-270 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) .github/scripts/aliyun-ecs-runner-provision.py:248 — .github/scripts/aliyun-ecs-runner-provision.py:248-266 | .github/scripts/aliyun-ecs-runner-teardown.py:108-126 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/frontend/src/instance.rs:1793 — src/frontend/src/instance.rs:1793-1812 | src/frontend/src/instance.rs:1814-1832 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/query/src/datafusion.rs:294 — src/query/src/datafusion.rs:294-312 | src/query/src/datafusion.rs:320-344 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/meta-srv/src/procedure/region_migration.rs:612 — src/meta-srv/src/procedure/region_migration.rs:612-631 | src/meta-srv/src/procedure/repartition/utils.rs:37-55 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/catalog/src/system_schema/information_schema/schemata.rs:214 — src/catalog/src/system_schema/information_schema/schemata.rs:214-233 | src/catalog/src/system_schema/information_schema/table_constraints.rs:231-249 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) src/common/meta/src/ddl_manager.rs:1467 — src/common/meta/src/ddl_manager.rs:1467-1485 | src/common/meta/src/ddl_manager.rs:1578-1596 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) tests-integration/src/cluster.rs:134 — tests-integration/src/cluster.rs:134-152 | tests-integration/src/cluster.rs:155-178 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×14
  • Duplicated block (17 lines × 2) src/common/function/src/scalars/geo/geohash.rs:50 — src/common/function/src/scalars/geo/geohash.rs:50-66 | src/common/function/src/scalars/geo/geohash.rs:147-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) src/common/function/src/scalars/geo/h3.rs:62 — src/common/function/src/scalars/geo/h3.rs:62-78 | src/common/function/src/scalars/geo/h3.rs:153-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) src/common/meta/src/key/table_info.rs:260 — src/common/meta/src/key/table_info.rs:260-276 | src/common/meta/src/key/view_info.rs:253-269 — before extracting anything, compare `src/common/meta/src/key/table_info.rs` and `src/common/meta/src/key/view_info.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/table_info.rs:260` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:47 — src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:47-63 | src/common/meta/src/reconciliation/reconcile_database/reconcile_tables.rs:45-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:47` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17 lines × 2) src/common/time/src/timestamp.rs:78 — src/common/time/src/timestamp.rs:78-94 | src/common/time/src/timestamp.rs:114-130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) src/file-engine/src/manifest.rs:47 — src/file-engine/src/manifest.rs:47-63 | src/relational-engine/src/manifest.rs:46-62 — before extracting anything, compare `src/file-engine/src/manifest.rs` and `src/relational-engine/src/manifest.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) src/meta-client/src/client/cluster.rs:176 — src/meta-client/src/client/cluster.rs:176-192 | src/meta-client/src/client/procedure.rs:210-226 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-client/src/client/cluster.rs:176` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17 lines × 2) src/metric-engine/src/engine/put.rs:466 — src/metric-engine/src/engine/put.rs:466-482 | src/metric-engine/src/engine/put.rs:504-520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/metric-engine/src/engine/put.rs:466` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) src/servers/src/otlp/metrics.rs:1053 — src/servers/src/otlp/metrics.rs:1053-1069 | src/servers/src/otlp/metrics.rs:1100-1116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/otlp/metrics.rs:1053` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) src/sql/src/parsers/create_parser/trigger.rs:392 — src/sql/src/parsers/create_parser/trigger.rs:392-408 | src/sql/src/parsers/create_parser/trigger.rs:433-449 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/create_parser/trigger.rs:392` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn parse_trigger_labels( &mut` in one and `crate) fn parse_trigger_annotations( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (17 lines × 2) src/common/function/src/scalars/geo/h3.rs:111 — src/common/function/src/scalars/geo/h3.rs:111-127 | src/common/function/src/scalars/geo/h3.rs:202-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) src/datanode/src/datanode.rs:1101 — src/datanode/src/datanode.rs:1101-1117 | src/datanode/src/datanode.rs:1163-1180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/datanode/src/datanode.rs:1101` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) tests-fuzz/src/utils/cluster_info.rs:49 — tests-fuzz/src/utils/cluster_info.rs:49-65 | tests-fuzz/src/utils/cluster_info.rs:82-98 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/src/utils/cluster_info.rs:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) tests-integration/src/test_util.rs:1118 — tests-integration/src/test_util.rs:1118-1134 | tests-integration/src/test_util.rs:1178-1194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tests-integration/src/test_util.rs:1118` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D30 · Dependency Vulnerabilities · Medium CVE · ×13
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×12
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/catalog/src/system_schema/information_schema/columns.rs:266 — src/catalog/src/system_schema/information_schema/columns.rs:266-304 | src/catalog/src/system_schema/information_schema/key_column_usage.rs:238-289 | src/catalog/src/system_schema/information_schema/statistics.rs:237-342 | src/catalog/src/system_schema/information_schema/table_constraints.rs:181-221 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/catalog/src/system_schema/information_schema/compaction_tasks.rs:69 — src/catalog/src/system_schema/information_schema/compaction_tasks.rs:69-87 | src/catalog/src/system_schema/information_schema/ssts.rs:73-89 | src/catalog/src/system_schema/information_schema/ssts.rs:135-152 | src/catalog/src/system_schema/information_schema/ssts.rs:198-215 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/cmd/src/bin/query_regression_runner/direct.rs:359 — src/cmd/src/bin/query_regression_runner/direct.rs:359-408 | src/cmd/src/bin/query_regression_runner/remote/ingest.rs:280-307 | src/cmd/src/bin/query_regression_runner/remote/read_bench.rs:280-306 | src/cmd/src/bin/query_regression_runner/remote/storage.rs:30-82 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/common/function/src/scalars/vector/vector_add.rs:62 — src/common/function/src/scalars/vector/vector_add.rs:62-89 | src/common/function/src/scalars/vector/vector_div.rs:63-90 | src/common/function/src/scalars/vector/vector_mul.rs:62-89 | src/common/function/src/scalars/vector/vector_sub.rs:61-88 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/common/meta/src/key/table_info.rs:218 — src/common/meta/src/key/table_info.rs:218-244 | src/common/meta/src/key/table_info.rs:250-276 | src/common/meta/src/key/view_info.rs:211-237 | src/common/meta/src/key/view_info.rs:243-269 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/common/meta/src/reconciliation/reconcile_catalog.rs:181 — src/common/meta/src/reconciliation/reconcile_catalog.rs:181-208 | src/common/meta/src/reconciliation/reconcile_database.rs:221-248 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:197-224 | src/common/meta/src/reconciliation/reconcile_table.rs:308-335 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/promql/src/functions/double_exponential_smoothing.rs:137 — src/promql/src/functions/double_exponential_smoothing.rs:137-213 | src/promql/src/functions/idelta.rs:63-171 | src/promql/src/functions/predict_linear.rs:61-213 | src/promql/src/functions/quantile.rs:56-196 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/promql/src/functions/native_histogram.rs:1118 — src/promql/src/functions/native_histogram.rs:1118-1189 | src/promql/src/functions/native_histogram.rs:1195-1289 | src/promql/src/functions/native_histogram.rs:2472-2655 | src/promql/src/functions/native_histogram.rs:2748-2849 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/query/src/promql/planner.rs:1696 — src/query/src/promql/planner.rs:1696-1754 | src/query/src/promql/planner.rs:1957-2081 | src/query/src/promql/planner.rs:6261-6339 | src/query/src/promql/planner.rs:6574-6599 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) src/common/meta/src/kv_backend/test.rs:549 — src/common/meta/src/kv_backend/test.rs:549-576 | src/common/meta/src/kv_backend/test.rs:578-616 | src/common/meta/src/kv_backend/test.rs:618-656 | src/common/meta/src/kv_backend/test.rs:658-696 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) tests-fuzz/src/translator/mysql/alter_expr.rs:89 — tests-fuzz/src/translator/mysql/alter_expr.rs:89-99 | tests-fuzz/src/translator/mysql/create_expr.rs:61-71 | tests-fuzz/src/translator/postgres/alter_expr.rs:75-85 | tests-fuzz/src/translator/postgres/create_expr.rs:57-67 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:118 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:118-238 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:66-188 | tests-fuzz/targets/ddl/fuzz_create_table.rs:91-121 | tests-fuzz/targets/fuzz_insert.rs:126-216 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×12
  • Duplicated block (19 lines × 2) src/cmd/src/frontend.rs:279 — src/cmd/src/frontend.rs:279-297 | src/cmd/src/standalone.rs:416-434 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `opts` to `&mut FrontendOptions` in one and `&mut StandaloneOptions` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (19 lines × 2) src/common/function/src/aggrs/geo/encoding.rs:80 — src/common/function/src/aggrs/geo/encoding.rs:80-98 | src/common/function/src/aggrs/geo/geo_path.rs:102-120 — before extracting anything, compare `src/common/function/src/aggrs/geo/encoding.rs` and `src/common/function/src/aggrs/geo/geo_path.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/geo/encoding.rs:80` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/common/recordbatch/src/filter/predicate.rs:300 — src/common/recordbatch/src/filter/predicate.rs:300-318 | src/common/recordbatch/src/filter/predicate.rs:351-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/recordbatch/src/filter/predicate.rs:300` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/flow/src/batching_mode/frontend_client.rs:398 — src/flow/src/batching_mode/frontend_client.rs:398-416 | src/flow/src/batching_mode/frontend_client.rs:558-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) src/flow/src/batching_mode/frontend_client.rs:478 — src/flow/src/batching_mode/frontend_client.rs:478-496 | src/flow/src/batching_mode/frontend_client.rs:739-757 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/frontend_client.rs:478` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/flow/src/batching_mode/frontend_client.rs:636 — src/flow/src/batching_mode/frontend_client.rs:636-654 | src/flow/src/batching_mode/frontend_client.rs:724-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/frontend_client.rs:636` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (19 lines × 2) src/mito2/src/memtable/bulk/part_reader.rs:121 — src/mito2/src/memtable/bulk/part_reader.rs:121-139 | src/mito2/src/memtable/bulk/part_reader.rs:149-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) src/mito2/src/memtable/bulk/part_reader.rs:194 — src/mito2/src/memtable/bulk/part_reader.rs:194-212 | src/mito2/src/memtable/bulk/part_reader.rs:355-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/memtable/bulk/part_reader.rs:194` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/servers/src/http/prometheus.rs:519 — src/servers/src/http/prometheus.rs:519-537 | src/servers/src/http/prometheus.rs:662-680 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http/prometheus.rs:519` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/servers/src/http/prometheus.rs:541 — src/servers/src/http/prometheus.rs:541-559 | src/servers/src/http/prometheus.rs:684-702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http/prometheus.rs:541` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19 lines × 2) src/catalog/src/system_schema/information_schema/flow_statistics.rs:81 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:81-99 | src/catalog/src/system_schema/information_schema/flows.rs:104-132 — before extracting anything, compare `src/catalog/src/system_schema/information_schema/flow_statistics.rs` and `src/catalog/src/system_schema/information_schema/flows.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) src/common/function/src/aggrs/vector/product.rs:43 — src/common/function/src/aggrs/vector/product.rs:43-61 | src/common/function/src/aggrs/vector/sum.rs:43-61 — before extracting anything, compare `src/common/function/src/aggrs/vector/product.rs` and `src/common/function/src/aggrs/vector/sum.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D6 · Cohesion (LCOM4) · Low cohesion · ×12
  • Low cohesion: MockKvBackend (LCOM4 7) src/common/meta/src/kv_backend/test_util.rs:37 — MockKvBackend's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: QueryEngineState (LCOM4 7) src/query/src/query_engine/state.rs:99 — QueryEngineState's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: GrpcServerBuilder (LCOM4 6) src/servers/src/grpc/builder.rs:85 — GrpcServerBuilder's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CacheManager (LCOM4 5) src/mito2/src/cache.rs:1108 — CacheManager's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DatanodeTableManager (LCOM4 4) src/common/meta/src/key/datanode_table.rs:151 — DatanodeTableManager's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: RegionServerInner (LCOM4 4) src/datanode/src/region_server.rs:1381 — RegionServerInner's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DefaultGcSchedulerCtx (LCOM4 4) src/meta-srv/src/gc/ctx.rs:154 — DefaultGcSchedulerCtx's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: WriteRequest (LCOM4 4) src/mito2/src/request.rs:74 — WriteRequest's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: DfContextProviderAdapter (LCOM4 4) src/query/src/datafusion/planner.rs:47 — DfContextProviderAdapter's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ColumnExtensions (LCOM4 4) src/sql/src/statements/create.rs:152 — ColumnExtensions's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: StandaloneInformationExtension (LCOM4 4) src/standalone/src/information_extension.rs:34 — StandaloneInformationExtension's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ScannerProperties (LCOM4 4) src/store-api/src/region_engine.rs:304 — ScannerProperties's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D2 · Cognitive Complexity · PromPlanner · ×11
  • PromPlanner::create_function_expr (cognitive 139) src/query/src/promql/planner.rs:3578 — PromPlanner::create_function_expr has cognitive complexity 139 (threshold 15). Drivers by points: if/else 70 (118 pts), loops 6 (13 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PromPlanner::or_operator (cognitive 91) src/query/src/promql/planner/set_operator.rs:43 — PromPlanner::or_operator has cognitive complexity 91 (threshold 15). Drivers by points: if/else 45 (59 pts), boolean chains 17, loops 6 (10 pts), match/switch 3 (5 pts) (nesting depth added 20). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • PromPlanner::prom_binary_expr_to_plan (cognitive 85) src/query/src/promql/planner.rs:1147 — PromPlanner::prom_binary_expr_to_plan has cognitive complexity 85 (threshold 15). Drivers by points: if/else 33 (56 pts), boolean chains 19, match/switch 5 (10 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PromPlanner::selector_to_series_normalize_plan (cognitive 44) src/query/src/promql/planner.rs:2529 — PromPlanner::selector_to_series_normalize_plan has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 4 (12 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PromPlanner::create_table_scan_plan (cognitive 36) src/query/src/promql/planner.rs:3062 — PromPlanner::create_table_scan_plan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 3 (6 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PromPlanner::prom_aggr_expr_to_plan (cognitive 32) src/query/src/promql/planner.rs:745 — PromPlanner::prom_aggr_expr_to_plan has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 4 (10 pts), boolean chains 3 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PromPlanner::matchers_to_expr (cognitive 28) src/query/src/promql/planner.rs:2806 — PromPlanner::matchers_to_expr has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PromPlanner::agg_modifier_to_col (cognitive 26) src/query/src/promql/planner.rs:2701 — PromPlanner::agg_modifier_to_col has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PromPlanner::build_time_index_filter (cognitive 23) src/query/src/promql/planner.rs:2941 — PromPlanner::build_time_index_filter has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 5 (7 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PromPlanner::build_binary_island_field_exprs (cognitive 21) src/query/src/promql/planner/island.rs:364 — PromPlanner::build_binary_island_field_exprs has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (11 pts), match/switch 3 (5 pts), if/else 1 (4 pts), boolean chains 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PromPlanner::set_op_on_non_field_columns (cognitive 17) src/query/src/promql/planner/set_operator.rs:670 — PromPlanner::set_op_on_non_field_columns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×11
  • Edited copy of a member (21 corresponding lines) src/catalog/src/system_schema/information_schema/flows.rs:436 — src/catalog/src/system_schema/information_schema/flows.rs:436-456 | src/catalog/src/system_schema/information_schema/statistics.rs:399-422 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/common/datasource/src/packed_writer.rs:157 — src/common/datasource/src/packed_writer.rs:157-177 | src/common/datasource/src/parquet_writer.rs:243-267 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/operator/src/req_convert/common/partitioner.rs:477 — src/operator/src/req_convert/common/partitioner.rs:477-497 | src/operator/src/req_convert/common/partitioner.rs:499-519 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/common/datasource/src/object_store/azblob.rs:37 — src/common/datasource/src/object_store/azblob.rs:37-61 | src/common/datasource/src/object_store/gcs.rs:36-56 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/common/function/src/aggrs/vector/product.rs:149 — src/common/function/src/aggrs/vector/product.rs:149-169 | src/common/function/src/aggrs/vector/sum.rs:148-168 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/common/meta/src/ddl_manager.rs:1307 — src/common/meta/src/ddl_manager.rs:1307-1327 | src/common/meta/src/ddl_manager.rs:1641-1661 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/common/meta/src/kv_backend/memory.rs:137 — src/common/meta/src/kv_backend/memory.rs:137-157 | src/common/meta/src/kv_backend/memory.rs:211-231 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/mito2/src/read/range.rs:186 — src/mito2/src/read/range.rs:186-209 | src/mito2/src/read/range.rs:281-301 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/store-api/src/metadata.rs:1336 — src/store-api/src/metadata.rs:1336-1357 | src/table/src/metadata.rs:1627-1647 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/common/meta/src/ddl/alter_table/executor.rs:253 — src/common/meta/src/ddl/alter_table/executor.rs:253-273 | src/common/meta/src/ddl/drop_table/executor.rs:251-272 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) src/datatypes/src/schema/column_schema.rs:805 — src/datatypes/src/schema/column_schema.rs:805-828 | src/datatypes/src/schema/column_schema.rs:1056-1076 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
AXH1 · Runtime security headers · Runtime security header not set · ×10
  • Runtime security header not set: content-security-policy — The live app's responses did not include content-security-policy (restricts the sources a page may load — mitigates XSS/injection). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: cross-origin-embedder-policy — The live app's responses did not include cross-origin-embedder-policy (recommended by the OWASP Secure Headers Project (value: require-corp)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: cross-origin-opener-policy — The live app's responses did not include cross-origin-opener-policy (recommended by the OWASP Secure Headers Project (value: same-origin)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: cross-origin-resource-policy — The live app's responses did not include cross-origin-resource-policy (recommended by the OWASP Secure Headers Project (value: same-origin)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: permissions-policy — The live app's responses did not include permissions-policy (restricts powerful browser features (camera, geolocation, …)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: referrer-policy — The live app's responses did not include referrer-policy (limits referrer leakage to third parties). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: strict-transport-security — The live app's responses did not include strict-transport-security (forces HTTPS on subsequent requests — mitigates downgrade/MITM). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: x-dns-prefetch-control — The live app's responses did not include x-dns-prefetch-control (recommended by the OWASP Secure Headers Project (value: off)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: x-frame-options — The live app's responses did not include x-frame-options (blocks clickjacking via framing (or use CSP frame-ancestors)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
  • Runtime security header not set: x-permitted-cross-domain-policies — The live app's responses did not include x-permitted-cross-domain-policies (recommended by the OWASP Secure Headers Project (value: none)). Observed by booting the app in-sandbox — advisory evidence for AppSec / CRA / NIS2 runtime secure-defaults. Set it at your reverse proxy or in the app.
D2 · Cognitive Complexity · operator · ×10
  • operator::req_convert::common::push_column_to_rows (cognitive 187) src/operator/src/req_convert/common.rs:202 — operator::req_convert::common::push_column_to_rows has cognitive complexity 187 (threshold 15). Drivers by points: if/else 62 (124 pts), loops 31 (62 pts), match/switch 1 (nesting depth added 93). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • operator::statement::semantic_graph::conventions::validate (cognitive 41) src/operator/src/statement/semantic_graph/conventions.rs:173 — operator::statement::semantic_graph::conventions::validate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 5 (7 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::statement::export_logical_tables::write_tables (cognitive 29) src/operator/src/statement/export_logical_tables.rs:433 — operator::statement::export_logical_tables::write_tables has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 5 (11 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::statement::copy_table_to::stream_to_managed_parquet_with_packed (cognitive 26) src/operator/src/statement/copy_table_to.rs:262 — operator::statement::copy_table_to::stream_to_managed_parquet_with_packed has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::expr_helper::expr_to_create (cognitive 25) src/operator/src/expr_helper.rs:262 — operator::expr_helper::expr_to_create has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::insert::fill_table_options_for_create (cognitive 25) src/operator/src/insert.rs:2362 — operator::insert::fill_table_options_for_create has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::expr_helper::to_alter_table_expr (cognitive 22) src/operator/src/expr_helper.rs:830 — operator::expr_helper::to_alter_table_expr has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 7 (16 pts), if/else 3 (6 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • operator::statement::export_database::run_database_export_jobs (cognitive 21) src/operator/src/statement/export_database.rs:321 — operator::statement::export_database::run_database_export_jobs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 3 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::req_convert::common::prepare_rows (cognitive 18) src/operator/src/req_convert/common.rs:74 — operator::req_convert::common::prepare_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (7 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • operator::statement::semantic_graph::relationships::co_declared_branch (cognitive 17) src/operator/src/statement/semantic_graph/relationships.rs:155 — operator::statement::semantic_graph::relationships::co_declared_branch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×10
  • Edited copy of a member (27 corresponding lines) src/common/function/src/aggrs/vector/avg.rs:87 — src/common/function/src/aggrs/vector/avg.rs:87-147 | src/common/function/src/aggrs/vector/product.rs:107-147 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/catalog/src/system_schema/information_schema/key_column_usage.rs:92 — src/catalog/src/system_schema/information_schema/key_column_usage.rs:92-141 | src/catalog/src/system_schema/information_schema/statistics.rs:102-128 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/frontend/src/instance/influxdb.rs:178 — src/frontend/src/instance/influxdb.rs:178-204 | src/servers/src/otlp/logs.rs:955-987 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/catalog/src/system_schema/information_schema/columns.rs:237 — src/catalog/src/system_schema/information_schema/columns.rs:237-263 | src/catalog/src/system_schema/information_schema/tables.rs:223-253 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/common/meta/src/key/flow/flownode_flow.rs:124 — src/common/meta/src/key/flow/flownode_flow.rs:124-150 | src/common/meta/src/key/flow/table_flow.rs:145-172 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/mito2/src/read/flat_merge.rs:799 — src/mito2/src/read/flat_merge.rs:799-825 | src/mito2/src/read/flat_merge.rs:946-979 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/servers/src/row_writer.rs:412 — src/servers/src/row_writer.rs:412-438 | src/servers/src/row_writer.rs:448-475 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/common/procedure/src/local/runner.rs:674 — src/common/procedure/src/local/runner.rs:674-702 | src/common/procedure/src/local/runner.rs:720-746 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/servers/src/http/dashboard.rs:78 — src/servers/src/http/dashboard.rs:78-106 | src/servers/src/http/dashboard.rs:143-169 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) src/query/src/sql.rs:771 — src/query/src/sql.rs:771-799 | src/query/src/sql.rs:819-845 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×10
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/catalog/src/system_schema/information_schema/flow_statistics.rs:130 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:130-148 | src/catalog/src/system_schema/information_schema/flows.rs:217-235 | src/catalog/src/system_schema/information_schema/table_semantics.rs:259-277 | src/catalog/src/system_schema/information_schema/tables.rs:163-181 | src/catalog/src/system_schema/information_schema/views.rs:126-144 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/cmd/src/datanode.rs:306 — src/cmd/src/datanode.rs:306-417 | src/cmd/src/flownode.rs:186-245 | src/cmd/src/frontend.rs:264-374 | src/cmd/src/metasrv.rs:230-318 | src/cmd/src/standalone.rs:411-488 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/common/function/src/scalars/vector/elem_avg.rs:35 — src/common/function/src/scalars/vector/elem_avg.rs:35-49 | src/common/function/src/scalars/vector/elem_product.rs:48-62 | src/common/function/src/scalars/vector/elem_sum.rs:35-49 | src/common/function/src/scalars/vector/vector_dim.rs:48-62 | src/common/function/src/scalars/vector/vector_norm.rs:51-65 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/common/meta/src/key/schema_name.rs:282 — src/common/meta/src/key/schema_name.rs:282-293 | src/common/meta/src/key/table_info.rs:181-193 | src/common/meta/src/key/table_repart.rs:212-224 | src/common/meta/src/key/table_route.rs:660-672 | src/common/meta/src/key/view_info.rs:182-194 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/pipeline/src/etl/processor/csv.rs:196 — src/pipeline/src/etl/processor/csv.rs:196-226 | src/pipeline/src/etl/processor/date.rs:196-227 | src/pipeline/src/etl/processor/dissect.rs:612-642 | src/pipeline/src/etl/processor/letter.rs:128-158 | src/pipeline/src/etl/processor/urlencoding.rs:129-158 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/pipeline/src/etl/processor/decolorize.rs:108 — src/pipeline/src/etl/processor/decolorize.rs:108-130 | src/pipeline/src/etl/processor/digest.rs:204-226 | src/pipeline/src/etl/processor/epoch.rs:184-209 | src/pipeline/src/etl/processor/gsub.rs:122-144 | src/pipeline/src/etl/processor/logfmt.rs:110-132 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) src/pipeline/src/etl/processor/dissect.rs:612 — src/pipeline/src/etl/processor/dissect.rs:612-642 | src/pipeline/src/etl/processor/join.rs:98-128 | src/pipeline/src/etl/processor/letter.rs:128-158 | src/pipeline/src/etl/processor/regex.rs:200-230 | src/pipeline/src/etl/processor/urlencoding.rs:129-158 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:101 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:101-116 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:66-188 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:125-140 | tests-fuzz/targets/fuzz_insert_logical_table.rs:103-118 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:124-139 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:118 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:118-238 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:224-325 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:66-188 | tests-fuzz/targets/ddl/fuzz_create_table.rs:91-121 | tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs:206-224 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:188 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:188-294 | tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:273-349 | tests-fuzz/targets/fuzz_insert_logical_table.rs:234-295 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:301-428 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:295-382 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×10
  • Duplicated block (18 lines × 2) src/catalog/src/system_schema/information_schema/columns.rs:326 — src/catalog/src/system_schema/information_schema/columns.rs:326-345 | src/catalog/src/system_schema/information_schema/tables.rs:363-380 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/columns.rs:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/catalog/src/system_schema/information_schema/columns.rs:346` calls `push`, `Some`, `is_string` and `src/catalog/src/system_schema/information_schema/tables.rs:381` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) src/cmd/src/flownode.rs:296 — src/cmd/src/flownode.rs:296-313 | src/cmd/src/frontend.rs:444-461 — before extracting anything, compare `src/cmd/src/flownode.rs` and `src/cmd/src/frontend.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) src/datanode/src/datanode.rs:795 — src/datanode/src/datanode.rs:795-812 | src/datanode/src/datanode.rs:837-854 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/datanode/src/datanode.rs:795` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) src/datanode/src/datanode.rs:816 — src/datanode/src/datanode.rs:816-833 | src/datanode/src/datanode.rs:867-884 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/datanode/src/datanode.rs:816` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) src/flow/src/batching_mode/frontend_client.rs:459 — src/flow/src/batching_mode/frontend_client.rs:459-476 | src/flow/src/batching_mode/frontend_client.rs:720-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/frontend_client.rs:459` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) src/flow/src/heartbeat.rs:195 — src/flow/src/heartbeat.rs:195-212 | src/frontend/src/heartbeat.rs:581-598 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) src/meta-srv/src/gc/handler.rs:345 — src/meta-srv/src/gc/handler.rs:345-362 | src/meta-srv/src/gc/handler.rs:378-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/gc/handler.rs:345` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) src/mito2/src/sst/index/column.rs:176 — src/mito2/src/sst/index/column.rs:176-193 | src/mito2/src/sst/index/inverted_index/applier.rs:450-467 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (18 lines × 2) src/operator/src/statement.rs:764 — src/operator/src/statement.rs:764-781 | src/operator/src/statement.rs:783-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:215 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:215-232 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:164-181 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · RegionWorkerLoop · ×9
  • RegionWorkerLoop::run (cyclomatic 23) src/mito2/src/worker.rs:1291 — RegionWorkerLoop::run has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: RegionWorkerLoop::handle_background_notify (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • RegionWorkerLoop::handle_region_edit (cyclomatic 21) src/mito2/src/worker/handle_manifest.rs:348 — RegionWorkerLoop::handle_region_edit has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RegionWorkerLoop::handle_alter_region_options_fast (cyclomatic 20) src/mito2/src/worker/handle_alter.rs:234 — RegionWorkerLoop::handle_alter_region_options_fast has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RegionWorkerLoop::process_write_requests (cyclomatic 19) src/mito2/src/worker/handle_write.rs:307 — RegionWorkerLoop::process_write_requests has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RegionWorkerLoop::execute_alter_request (cyclomatic 18) src/mito2/src/worker/handle_alter.rs:49 — RegionWorkerLoop::execute_alter_request has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RegionWorkerLoop::handle_write_requests (cyclomatic 17) src/mito2/src/worker/handle_write.rs:46 — RegionWorkerLoop::handle_write_requests has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • RegionWorkerLoop::process_bulk_requests (cyclomatic 17) src/mito2/src/worker/handle_write.rs:485 — RegionWorkerLoop::process_bulk_requests has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • RegionWorkerLoop::handle_requests (cyclomatic 17) src/mito2/src/worker.rs:1476 — RegionWorkerLoop::handle_requests has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: RegionWorkerLoop::handle_background_notify (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • RegionWorkerLoop::handle_rebuild_index (cyclomatic 16) src/mito2/src/worker/handle_rebuild_index.rs:167 — RegionWorkerLoop::handle_rebuild_index has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×9
  • Edited copy of a member (28 corresponding lines) src/common/function/src/scalars/ip/ipv4.rs:150 — src/common/function/src/scalars/ip/ipv4.rs:150-177 | src/common/function/src/scalars/ip/ipv6.rs:162-199 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/meta-srv/src/cluster.rs:238 — src/meta-srv/src/cluster.rs:238-265 | src/meta-srv/src/cluster.rs:267-296 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/meta-srv/src/selector/lease_based.rs:33 — src/meta-srv/src/selector/lease_based.rs:33-60 | src/meta-srv/src/selector/load_based.rs:52-89 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/promql/src/extension_plan/instant_manipulate.rs:408 — src/promql/src/extension_plan/instant_manipulate.rs:408-435 | src/promql/src/extension_plan/range_manipulate.rs:235-265 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/mito2/src/series_index/writer.rs:321 — src/mito2/src/series_index/writer.rs:321-348 | src/mito2/src/sst/range_index/writer.rs:336-363 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/partition/src/manager.rs:84 — src/partition/src/manager.rs:84-118 | src/partition/src/manager.rs:144-171 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/mito2/src/sst/parquet/row_selection.rs:255 — src/mito2/src/sst/parquet/row_selection.rs:255-290 | src/mito2/src/sst/parquet/row_selection.rs:307-334 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) src/operator/src/request.rs:76 — src/operator/src/request.rs:76-103 | src/operator/src/request.rs:173-207 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) tests-fuzz/targets/ddl/fuzz_repartition_table.rs:128 — tests-fuzz/targets/ddl/fuzz_repartition_table.rs:128-158 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:153-180 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×9
  • Edited copies of one member (3 members, 13+ corresponding lines) src/catalog/src/system_schema/information_schema/region_peers.rs:87 — src/catalog/src/system_schema/information_schema/region_peers.rs:87-99 | src/catalog/src/system_schema/information_schema/table_semantics.rs:211-229 | src/catalog/src/system_schema/information_schema/views.rs:75-96 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) src/common/meta/src/rpc/ddl.rs:566 — src/common/meta/src/rpc/ddl.rs:566-578 | src/common/meta/src/rpc/ddl.rs:871-883 | src/common/meta/src/rpc/ddl.rs:962-974 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) src/common/function/src/system/pg_catalog.rs:195 — src/common/function/src/system/pg_catalog.rs:195-207 | src/common/function/src/system/pg_catalog.rs:244-256 | src/common/function/src/system/pg_catalog.rs:293-305 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) src/common/meta/src/key/tombstone.rs:445 — src/common/meta/src/key/tombstone.rs:445-460 | src/common/meta/src/key/tombstone.rs:486-498 | src/common/meta/src/key/tombstone.rs:505-519 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) src/common/meta/src/region_keeper.rs:69 — src/common/meta/src/region_keeper.rs:69-83 | src/meta-srv/src/procedure/drain_datanode/manager.rs:60-72 | src/meta-srv/src/procedure/region_migration/manager.rs:63-75 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) src/promql/src/functions/native_histogram.rs:1295 — src/promql/src/functions/native_histogram.rs:1295-1308 | src/promql/src/functions/native_histogram.rs:1313-1325 | src/promql/src/functions/native_histogram.rs:2854-2867 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) src/common/meta/src/ddl/create_flow.rs:378 — src/common/meta/src/ddl/create_flow.rs:378-392 | src/common/meta/src/ddl/create_logical_tables.rs:232-245 | src/common/meta/src/ddl/create_view.rs:246-258 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) REDACTED:438 — REDACTED:438-453 | REDACTED:455-470 | REDACTED:472-484 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:108 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:108-120 | tests-fuzz/targets/fuzz_insert_logical_table.rs:139-151 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:107-119 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×9
  • Duplicated block (12–13 lines × 2) src/common/datasource/src/packed_writer.rs:160 — src/common/datasource/src/packed_writer.rs:160-171 | src/common/datasource/src/parquet_writer.rs:249-261 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/datasource/src/packed_writer.rs:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) src/datanode/src/service.rs:66 — src/datanode/src/service.rs:66-78 | src/flow/src/server.rs:417-428 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/datanode/src/service.rs:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/datanode/src/service.rs:79` calls `with_greptime_config_options`, `to_toml`, `context` and `src/flow/src/server.rs:429` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12–13 lines × 2) src/meta-client/src/client.rs:520 — src/meta-client/src/client.rs:520-532 | src/meta-client/src/client.rs:556-567 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-client/src/client.rs:520` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–13 lines × 2) src/mito2/src/cache/index/inverted_index.rs:114 — src/mito2/src/cache/index/inverted_index.rs:114-126 | src/mito2/src/cache/index/inverted_index.rs:144-155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/cache/index/inverted_index.rs:114` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12–13 lines × 2) src/mito2/src/read/seq_scan.rs:658 — src/mito2/src/read/seq_scan.rs:658-670 | src/mito2/src/read/unordered_scan.rs:395-406 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/unordered_scan.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/seq_scan.rs:658` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) src/mito2/src/read/series_scan.rs:1129 — src/mito2/src/read/series_scan.rs:1129-1141 | src/mito2/src/read/series_scan.rs:1145-1156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12–13 lines × 2) src/promql/src/extension_plan/normalize.rs:295 — src/promql/src/extension_plan/normalize.rs:295-307 | src/promql/src/extension_plan/series_divide.rs:358-369 — before extracting anything, compare `src/promql/src/extension_plan/normalize.rs` and `src/promql/src/extension_plan/series_divide.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12–13 lines × 2) src/query/src/promql/planner.rs:2624 — src/query/src/promql/planner.rs:2624-2636 | src/query/src/promql/planner.rs:3277-3288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:2624` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) src/sql/src/parsers/alter_parser/trigger.rs:350 — src/sql/src/parsers/alter_parser/trigger.rs:350-362 | src/sql/src/parsers/create_parser/trigger.rs:424-435 — `src/sql/src/parsers/alter_parser/trigger.rs` and `src/sql/src/parsers/create_parser/trigger.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 54 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/alter_parser/trigger.rs:350` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn parse_trigger_annotations( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×9
  • Duplicated block (9 lines × 3) src/client/src/flow.rs:69 — src/client/src/flow.rs:69-77 | src/client/src/flow.rs:96-104 | src/client/src/flow.rs:110-118 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/client/src/flow.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) src/promql/src/extension_plan/instant_manipulate.rs:150 — src/promql/src/extension_plan/instant_manipulate.rs:150-158 | src/promql/src/extension_plan/normalize.rs:102-110 | src/promql/src/extension_plan/series_divide.rs:195-203 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/normalize.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/promql/src/extension_plan/normalize.rs:114` calls `push`, `index_of_column_by_name` and `src/promql/src/extension_plan/series_divide.rs:207` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) src/query/src/optimizer/type_conversion.rs:85 — src/query/src/optimizer/type_conversion.rs:85-93 | src/query/src/optimizer/type_conversion.rs:103-111 | src/query/src/optimizer/type_conversion.rs:119-127 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/optimizer/type_conversion.rs:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) src/servers/src/grpc/flight/stream.rs:230 — src/servers/src/grpc/flight/stream.rs:230-238 | src/servers/src/grpc/flight/stream.rs:353-361 | src/servers/src/grpc/flight/stream.rs:614-622 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/grpc/flight/stream.rs:353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 3) src/common/time/src/duration.rs:81 — src/common/time/src/duration.rs:81-89 | src/common/time/src/time.rs:95-103 | src/common/time/src/timestamp.rs:296-304 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 3) src/common/meta/src/key/table_info.rs:205 — src/common/meta/src/key/table_info.rs:205-213 | src/common/meta/src/key/topic_name.rs:199-207 | src/common/meta/src/key/view_info.rs:200-208 — before extracting anything, compare `src/common/meta/src/key/table_info.rs` and `src/common/meta/src/key/view_info.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/table_info.rs:205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) src/promql/src/extension_plan/histogram_fold.rs:221 — src/promql/src/extension_plan/histogram_fold.rs:221-230 | src/promql/src/extension_plan/instant_manipulate.rs:185-193 | src/promql/src/extension_plan/normalize.rs:138-146 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/normalize.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/histogram_fold.rs:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 3) src/common/function/src/aggrs/vector/avg.rs:69 — src/common/function/src/aggrs/vector/avg.rs:69-77 | src/common/function/src/aggrs/vector/product.rs:68-76 | src/common/function/src/aggrs/vector/sum.rs:68-76 — before extracting anything, compare `src/common/function/src/aggrs/vector/product.rs` and `src/common/function/src/aggrs/vector/sum.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/vector/avg.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 3) src/common/meta/src/kv_backend/test.rs:273 — src/common/meta/src/kv_backend/test.rs:273-281 | src/common/meta/src/kv_backend/test.rs:285-293 | src/common/meta/src/kv_backend/test.rs:297-305 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×9
  • Duplicated block (7 lines × 3) src/common/function/src/scalars/geo/h3.rs:1007 — src/common/function/src/scalars/geo/h3.rs:1007-1013 | src/common/function/src/scalars/geo/h3.rs:1218-1224 | src/common/function/src/scalars/geo/h3.rs:1284-1290 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:1007` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) src/common/meta/src/key.rs:1628 — src/common/meta/src/key.rs:1628-1634 | src/common/meta/src/key.rs:1797-1803 | src/common/meta/src/key/schema_name.rs:304-310 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:1628` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7 lines × 3) src/flow/src/batching_mode/state.rs:608 — src/flow/src/batching_mode/state.rs:608-614 | src/flow/src/batching_mode/state.rs:741-747 | src/flow/src/batching_mode/state.rs:756-762 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/state.rs:608` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) src/mito2/src/read/seq_scan.rs:88 — src/mito2/src/read/seq_scan.rs:88-94 | src/mito2/src/read/series_scan.rs:147-153 | src/mito2/src/read/unordered_scan.rs:66-72 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/series_scan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) src/pipeline/src/etl/processor/json_parse.rs:102 — src/pipeline/src/etl/processor/json_parse.rs:102-108 | src/pipeline/src/etl/processor/json_path.rs:134-140 | src/pipeline/src/etl/processor/simple_extract.rs:105-111 — before extracting anything, compare `src/pipeline/src/etl/processor/json_path.rs` and `src/pipeline/src/etl/processor/simple_extract.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/json_parse.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) src/sql/src/parsers/alter_parser/trigger.rs:315 — src/sql/src/parsers/alter_parser/trigger.rs:315-322 | src/sql/src/parsers/create_parser/trigger.rs:392-398 | src/sql/src/parsers/create_parser/trigger.rs:433-439 — `src/sql/src/parsers/alter_parser/trigger.rs` and `src/sql/src/parsers/create_parser/trigger.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 54 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn parse_trigger_labels( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 3) src/common/meta/src/reconciliation/reconcile_database.rs:250 — src/common/meta/src/reconciliation/reconcile_database.rs:250-256 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:226-232 | src/common/meta/src/reconciliation/reconcile_table.rs:337-343 — before extracting anything, compare `src/common/meta/src/reconciliation/reconcile_database.rs` and `src/common/meta/src/reconciliation/reconcile_logical_tables.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 3) src/common/meta/src/reconciliation/reconcile_catalog.rs:145 — src/common/meta/src/reconciliation/reconcile_catalog.rs:145-151 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:173-179 | src/common/meta/src/reconciliation/reconcile_table.rs:268-274 — before extracting anything, compare `src/common/meta/src/reconciliation/reconcile_catalog.rs` and `src/common/meta/src/reconciliation/reconcile_logical_tables.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/reconciliation/reconcile_catalog.rs:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) src/common/meta/src/key.rs:801 — src/common/meta/src/key.rs:801-809 | src/common/meta/src/key.rs:1531-1537 | src/common/meta/src/key.rs:1743-1751 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:801` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×9
  • Duplicated block (6 lines × 3) src/sql/src/parsers/alter_parser/trigger.rs:111 — src/sql/src/parsers/alter_parser/trigger.rs:111-116 | src/sql/src/parsers/alter_parser/trigger.rs:138-143 | src/sql/src/parsers/alter_parser/trigger.rs:171-176 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/alter_parser/trigger.rs:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) src/common/function/src/scalars/geo/geohash.rs:99 — src/common/function/src/scalars/geo/geohash.rs:99-104 | src/common/function/src/scalars/geo/h3.rs:198-203 | src/common/function/src/scalars/geo/wkt.rs:82-87 — before extracting anything, compare `src/common/function/src/scalars/geo/geohash.rs` and `src/common/function/src/scalars/geo/h3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/geohash.rs:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) src/common/function/src/scalars/geo/measure.rs:72 — src/common/function/src/scalars/geo/measure.rs:72-77 | src/common/function/src/scalars/geo/measure.rs:135-140 | src/common/function/src/scalars/uddsketch_calc.rs:102-107 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/measure.rs:72` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) src/query/src/sql.rs:651 — src/query/src/sql.rs:651-656 | src/query/src/sql.rs:731-736 | src/query/src/sql.rs:1152-1157 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) src/cli/src/metadata/control/del.rs:36 — src/cli/src/metadata/control/del.rs:36-41 | src/cli/src/metadata/control/get.rs:41-46 | src/cli/src/metadata/control/put.rs:50-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) src/common/meta/src/cache/flow/table_flownode.rs:62 — src/common/meta/src/cache/flow/table_flownode.rs:62-67 | src/common/meta/src/cache/table/table_name.rs:40-45 | src/common/meta/src/cache/table/view_info.rs:39-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/cache/flow/table_flownode.rs:62` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `cache` to `Cache<TableId, FlownodeFlowSet>` in one and `Cache<TableName, TableId>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 3) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:82 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:82-87 | tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:91-96 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:80-85 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:88` calls `get_gt_fuzz_input_max_columns`, `unwrap_or_else`, `random_range` and `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:81` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:88 — tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:88-93 | tests-fuzz/targets/fuzz_insert.rs:71-76 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:84-89 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) src/common/meta/src/kv_backend/test.rs:162 — src/common/meta/src/kv_backend/test.rs:162-168 | src/common/meta/src/kv_backend/test.rs:178-184 | src/common/meta/src/kv_backend/test.rs:344-349 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/kv_backend/test.rs:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · PromPlanner · ×8
  • PromPlanner::create_function_expr (cyclomatic 106) src/query/src/promql/planner.rs:3578 — PromPlanner::create_function_expr has cyclomatic complexity 106 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PromPlanner::or_operator (cyclomatic 61) src/query/src/promql/planner/set_operator.rs:43 — PromPlanner::or_operator has cyclomatic complexity 61 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • PromPlanner::prom_binary_expr_to_plan (cyclomatic 52) src/query/src/promql/planner.rs:1147 — PromPlanner::prom_binary_expr_to_plan has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PromPlanner::build_time_index_filter (cyclomatic 24) src/query/src/promql/planner.rs:2941 — PromPlanner::build_time_index_filter has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • PromPlanner::create_table_scan_plan (cyclomatic 22) src/query/src/promql/planner.rs:3062 — PromPlanner::create_table_scan_plan has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PromPlanner::selector_to_series_normalize_plan (cyclomatic 19) src/query/src/promql/planner.rs:2529 — PromPlanner::selector_to_series_normalize_plan has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PromPlanner::prom_call_expr_to_plan (cyclomatic 18) src/query/src/promql/planner.rs:2250 — PromPlanner::prom_call_expr_to_plan has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • PromPlanner::matchers_to_expr (cyclomatic 16) src/query/src/promql/planner.rs:2806 — PromPlanner::matchers_to_expr has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mito2 · ×8
  • mito2::read::seq_scan::build_flat_sources (cyclomatic 23) src/mito2/src/read/seq_scan.rs:683 — mito2::read::seq_scan::build_flat_sources has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mito2::sst::parquet::prefilter::build_reader_filter_plan (cyclomatic 21) src/mito2/src/sst/parquet/prefilter.rs:414 — mito2::sst::parquet::prefilter::build_reader_filter_plan has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mito2::sst::index::column::json_index_target (cyclomatic 19) src/mito2/src/sst/index/column.rs:96 — mito2::sst::index::column::json_index_target has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • mito2::compaction::twcs::units::pick_closed_merge_candidates (cyclomatic 18) src/mito2/src/compaction/twcs/units.rs:329 — mito2::compaction::twcs::units::pick_closed_merge_candidates has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • mito2::region::opener::preload_parquet_meta_cache_for_files (cyclomatic 18) src/mito2/src/region/opener.rs:1285 — mito2::region::opener::preload_parquet_meta_cache_for_files has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mito2::series_index::maintenance::build_index_version (cyclomatic 18) src/mito2/src/series_index/maintenance.rs:185 — mito2::series_index::maintenance::build_index_version has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mito2::read::scan_util::should_split_flat_batches_for_merge (cyclomatic 16) src/mito2/src/read/scan_util.rs:1257 — mito2::read::scan_util::should_split_flat_batches_for_merge has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • mito2::sst::parquet::format::column_values_by_type (cyclomatic 16) src/mito2/src/sst/parquet/format.rs:150 — mito2::sst::parquet::format::column_values_by_type has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · ParserContext · ×8
  • ParserContext::parse_show (cognitive 50) src/sql/src/parsers/show_parser.rs:38 — ParserContext::parse_show has cognitive complexity 50 (threshold 15). Drivers by points: if/else 37 (43 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ParserContext::parse_one_impl (cognitive 29) src/common/function/src/scalars/matches.rs:569 — ParserContext::parse_one_impl has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 4 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParserContext::parse_create_flow (cognitive 27) src/sql/src/parsers/create_parser.rs:301 — ParserContext::parse_create_flow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ParserContext::to_rpn (cognitive 22) src/common/function/src/scalars/matches.rs:511 — ParserContext::to_rpn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParserContext::accomplish_optional_unary_op (cognitive 17) src/common/function/src/scalars/matches.rs:452 — ParserContext::accomplish_optional_unary_op has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ParserContext::parse_alter_trigger (cognitive 17) src/sql/src/parsers/alter_parser/trigger.rs:65 — ParserContext::parse_alter_trigger has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (14 pts), boolean chains 1, if/else 1, loops 1 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ParserContext::parse_create (cognitive 16) src/sql/src/parsers/create_parser.rs:85 — ParserContext::parse_create has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 6 (16 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • ParserContext::parse_tql_query (cognitive 16) src/sql/src/parsers/tql_parser.rs:363 — ParserContext::parse_tql_query has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Instance · ×8
  • Instance::ingest_trace_spans (cognitive 45) src/frontend/src/instance/otlp/trace_ingest.rs:1042 — Instance::ingest_trace_spans has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (25 pts), loops 4 (10 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::reconcile_trace_column_types (cognitive 42) src/frontend/src/instance/otlp/trace_ingest.rs:2257 — Instance::reconcile_trace_column_types has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::prevalidate_trace_v1_fixed_columns (cognitive 25) src/frontend/src/instance/otlp/trace_ingest.rs:1882 — Instance::prevalidate_trace_v1_fixed_columns has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::metrics (cognitive 24) src/frontend/src/instance/otlp.rs:99 — Instance::metrics has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), match/switch 4 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • Instance::query_exemplars_inner (cognitive 22) src/frontend/src/instance/exemplar.rs:57 — Instance::query_exemplars_inner has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 3 (6 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • Instance::prepare_trace_v1_request_schema (cognitive 19) src/frontend/src/instance/otlp/trace_ingest.rs:1802 — Instance::prepare_trace_v1_request_schema has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::do_query_inner (cognitive 18) src/frontend/src/instance.rs:758 — Instance::do_query_inner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Instance::ingest_trace_chunk (cognitive 16) src/frontend/src/instance/otlp/trace_ingest.rs:1395 — Instance::ingest_trace_chunk has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (8 pts), match/switch 3 (5 pts), if/else 2 (3 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D3 · God Classes · TooManyFields · ×8
  • TooManyFields: ScanMetricsSet src/mito2/src/read/scan_util.rs:115 — TooManyFields — 66 stored fields beside 7 methods. The bar is 30 stored fields; this is 36 over it, 2.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: MitoConfig src/mito2/src/config.rs:72 — TooManyFields — 52 stored fields beside 2 methods. The bar is 30 stored fields; this is 22 over it, 1.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RegionWorkerLoop src/mito2/src/worker.rs:1180 — TooManyFields — 44 stored fields beside 106 methods. The bar is 30 stored fields; this is 14 over it, 1.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Actor src/log-store/src/object_store_wal/store.rs:1516 — TooManyFields — 43 stored fields beside 42 methods. The bar is 30 stored fields; this is 13 over it, 1.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Metasrv src/meta-srv/src/metasrv.rs:587 — TooManyFields — 38 stored fields beside 42 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: StandaloneOptions src/standalone/src/options.rs:42 — TooManyFields — 35 stored fields beside 3 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ScanInput src/mito2/src/read/scan_region.rs:913 — TooManyFields — 34 stored fields beside 26 methods. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: MetasrvOptions src/meta-srv/src/metasrv.rs:211 — TooManyFields — 33 stored fields. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×8
  • Edited copy of a member (29 corresponding lines) src/catalog/src/system_schema/information_schema/columns.rs:417 — src/catalog/src/system_schema/information_schema/columns.rs:417-452 | src/catalog/src/system_schema/information_schema/tables.rs:428-456 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) src/mito2/src/read/series_scan.rs:373 — src/mito2/src/read/series_scan.rs:373-401 | src/mito2/src/read/series_scan.rs:407-439 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) src/common/time/src/range.rs:40 — src/common/time/src/range.rs:40-68 | src/common/time/src/range.rs:74-109 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) src/meta-srv/src/handler/keep_lease_handler.rs:41 — src/meta-srv/src/handler/keep_lease_handler.rs:41-70 | src/meta-srv/src/handler/keep_lease_handler.rs:87-115 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) src/sql/src/parsers/alter_parser.rs:632 — src/sql/src/parsers/alter_parser.rs:632-663 | src/sql/src/parsers/alter_parser.rs:665-693 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) src/mito2/src/read/seq_scan.rs:551 — src/mito2/src/read/seq_scan.rs:551-579 | src/mito2/src/read/series_scan.rs:480-512 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) src/meta-srv/src/service/procedure.rs:305 — src/meta-srv/src/service/procedure.rs:305-333 | src/meta-srv/src/service/procedure.rs:335-367 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) tests-fuzz/src/ir.rs:181 — tests-fuzz/src/ir.rs:181-209 | tests-fuzz/src/ir.rs:212-240 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×8
  • Edited copy of a member (30 corresponding lines) src/common/function/src/aggrs/geo/encoding.rs:216 — src/common/function/src/aggrs/geo/encoding.rs:216-245 | src/common/function/src/aggrs/geo/geo_path.rs:245-274 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) src/common/meta/src/kv_backend/rds.rs:291 — src/common/meta/src/kv_backend/rds.rs:291-320 | src/common/meta/src/kv_backend/rds.rs:355-388 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) REDACTED:704 — REDACTED:704-733 | REDACTED:528-562 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) src/servers/src/prom_store.rs:946 — src/servers/src/prom_store.rs:946-975 | src/servers/src/prom_store.rs:978-1008 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) src/mito2/src/flush.rs:1610 — src/mito2/src/flush.rs:1610-1639 | src/mito2/src/flush.rs:1650-1679 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) src/servers/src/otlp/logs.rs:1265 — src/servers/src/otlp/logs.rs:1265-1294 | src/servers/src/otlp/utils.rs:42-72 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) src/common/time/src/timestamp.rs:77 — src/common/time/src/timestamp.rs:77-106 | src/common/time/src/timestamp.rs:113-142 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) src/mito2/src/sst/index/bloom_filter/applier.rs:404 — src/mito2/src/sst/index/bloom_filter/applier.rs:404-435 | src/mito2/src/sst/index/inverted_index/applier.rs:349-378 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×8
  • Edited copy of a member (6 corresponding lines) src/mito2/src/read/seq_scan.rs:633 — src/mito2/src/read/seq_scan.rs:633-638 | src/mito2/src/read/unordered_scan.rs:370-375 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py:291 — .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py:291-300 | .github/scripts/aliyun-ecs-runner-provision.py:286-291 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) src/common/function/src/scalars/vector/distance/dot.rs:20 — src/common/function/src/scalars/vector/distance/dot.rs:20-25 | src/common/function/src/scalars/vector/distance/l2sq.rs:20-25 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) src/common/meta/src/cache/table/schema.rs:35 — src/common/meta/src/cache/table/schema.rs:35-40 | src/common/meta/src/cache/table/table_schema.rs:39-44 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) REDACTED:101 — REDACTED:101-106 | src/common/meta/src/kv_backend/rds/postgres.rs:239-244 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) src/datatypes/src/vectors/boolean.rs:224 — src/datatypes/src/vectors/boolean.rs:224-229 | src/datatypes/src/vectors/string.rs:484-489 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) src/mito2/src/memtable/bulk.rs:670 — src/mito2/src/memtable/bulk.rs:670-675 | src/mito2/src/memtable/simple_bulk_memtable.rs:358-363 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) src/query/src/dummy_catalog.rs:462 — src/query/src/dummy_catalog.rs:462-467 | src/query/src/metrics.rs:232-237 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×8
  • Duplicated block (12 lines × 3) src/cmd/src/datanode.rs:309 — src/cmd/src/datanode.rs:309-320 | src/cmd/src/metasrv.rs:233-244 | src/cmd/src/standalone.rs:412-423 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `opts` to `&mut DatanodeOptions` in one and `&mut MetasrvOptions` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 3) src/common/function/src/admin/reconcile_catalog.rs:94 — src/common/function/src/admin/reconcile_catalog.rs:94-105 | src/common/function/src/admin/reconcile_database.rs:103-114 | src/common/function/src/admin/reconcile_table.rs:84-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/admin/reconcile_catalog.rs:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) src/common/time/src/duration.rs:203 — src/common/time/src/duration.rs:203-214 | src/common/time/src/time.rs:191-202 | src/common/time/src/timestamp.rs:725-736 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 3) src/mito2/src/manifest/manager.rs:375 — src/mito2/src/manifest/manager.rs:375-386 | src/mito2/src/manifest/manager.rs:555-566 | src/mito2/src/manifest/manager.rs:819-830 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/manifest/manager.rs:375` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) src/promql/src/extension_plan/empty_metric.rs:208 — src/promql/src/extension_plan/empty_metric.rs:208-219 | src/promql/src/extension_plan/range_manipulate.rs:271-282 | src/promql/src/extension_plan/scalar_calculate.rs:237-248 — before extracting anything, compare `src/promql/src/extension_plan/range_manipulate.rs` and `src/promql/src/extension_plan/scalar_calculate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) src/promql/src/extension_plan/normalize.rs:337 — src/promql/src/extension_plan/normalize.rs:337-348 | src/promql/src/extension_plan/range_manipulate.rs:527-538 | src/promql/src/extension_plan/series_divide.rs:428-439 — before extracting anything, compare `src/promql/src/extension_plan/normalize.rs` and `src/promql/src/extension_plan/series_divide.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 3) src/file-engine/src/engine.rs:289 — src/file-engine/src/engine.rs:289-300 | src/file-engine/src/engine.rs:322-333 | src/relational-engine/src/engine.rs:323-334 — before extracting anything, compare `src/file-engine/src/engine.rs` and `src/relational-engine/src/engine.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/file-engine/src/engine.rs:289` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `RegionCreateRequest` in one and `RegionOpenRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 3) src/cmd/src/bin/query_regression_runner/direct.rs:384 — src/cmd/src/bin/query_regression_runner/direct.rs:384-395 | src/cmd/src/bin/query_regression_runner/remote/ingest.rs:282-293 | src/cmd/src/bin/query_regression_runner/remote/storage.rs:53-64 — before extracting anything, compare `src/cmd/src/bin/query_regression_runner/remote/ingest.rs` and `src/cmd/src/bin/query_regression_runner/remote/storage.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×8
  • Duplicated block (11–12 lines × 2) src/cmd/src/datanode.rs:313 — src/cmd/src/datanode.rs:313-323 | src/cmd/src/flownode.rs:201-212 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/datanode.rs:313` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `opts` to `&mut DatanodeOptions` in one and `&mut FlownodeOptions` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11–12 lines × 2) src/common/meta/src/ddl/create_table.rs:311 — src/common/meta/src/ddl/create_table.rs:311-322 | src/common/meta/src/ddl/drop_database/executor.rs:73-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11–12 lines × 2) src/common/meta/src/reconciliation/reconcile_logical_tables/reconcile_regions.rs:50 — src/common/meta/src/reconciliation/reconcile_logical_tables/reconcile_regions.rs:50-61 | src/common/meta/src/reconciliation/reconcile_table/reconcile_regions.rs:92-102 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `ctx` to `&mut ReconcileLogicalTablesContext` in one and `&mut ReconcileTableContext` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11–12 lines × 2) src/frontend/src/instance/promql.rs:113 — src/frontend/src/instance/promql.rs:113-124 | src/frontend/src/instance/promql.rs:330-340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/promql.rs:113` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) src/mito-codec/src/row_converter/sparse.rs:161 — src/mito-codec/src/row_converter/sparse.rs:161-171 | src/mito-codec/src/row_converter/sparse.rs:474-485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito-codec/src/row_converter/sparse.rs:161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–12 lines × 2) src/operator/src/statement/copy_table_from.rs:335 — src/operator/src/statement/copy_table_from.rs:335-345 | src/operator/src/statement/copy_table_from.rs:362-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/statement/copy_table_from.rs:335` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–12 lines × 2) src/query/src/sql.rs:1053 — src/query/src/sql.rs:1053-1064 | src/query/src/sql/show_create_table.rs:256-266 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/sql.rs:1053` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/query/src/sql.rs:1051` calls `table_info` and `src/query/src/sql/show_create_table.rs:255` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11–12 lines × 2) src/servers/src/http/prometheus.rs:1962 — src/servers/src/http/prometheus.rs:1962-1972 | src/servers/src/http/prometheus.rs:2567-2578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · query · ×7
  • query::dist_plan::analyzer::utils::get_alias_layer_from_node (cognitive 32) src/query/src/dist_plan/analyzer/utils.rs:340 — query::dist_plan::analyzer::utils::get_alias_layer_from_node has cognitive complexity 32 (threshold 15). Drivers by points: loops 5 (18 pts), if/else 7 (13 pts), match/switch 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • query::optimizer::expr_depth::validate_plan_exprs (cognitive 32) src/query/src/optimizer/expr_depth.rs:58 — query::optimizer::expr_depth::validate_plan_exprs has cognitive complexity 32 (threshold 15). Drivers by points: loops 6 (19 pts), if/else 6 (11 pts), match/switch 1 (2 pts) (nesting depth added 19). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • query::window_sort::compute_all_working_ranges (cognitive 26) src/query/src/window_sort.rs:1174 — query::window_sort::compute_all_working_ranges has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • query::promql::planner::matching_filters::try_propagate (cognitive 23) src/query/src/promql/planner/matching_filters.rs:96 — query::promql::planner::matching_filters::try_propagate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • query::dist_plan::remote_dyn_filter_registry::run_entry_fanout (cognitive 19) src/query/src/dist_plan/remote_dyn_filter_registry.rs:321 — query::dist_plan::remote_dyn_filter_registry::run_entry_fanout has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • query::sql::show_create_table::create_column (cognitive 17) src/query/src/sql/show_create_table.rs:85 — query::sql::show_create_table::create_column has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • query::dist_plan::analyzer::utils::aliased_columns_for_inner (cognitive 16) src/query/src/dist_plan/analyzer/utils.rs:284 — query::dist_plan::analyzer::utils::aliased_columns_for_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×7
  • Duplicated block (10 lines × 3) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:232 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:232-241 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:221-230 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:202-211 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:232` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) src/promql/src/extension_plan/instant_manipulate.rs:574 — src/promql/src/extension_plan/instant_manipulate.rs:574-583 | src/promql/src/extension_plan/range_manipulate.rs:586-595 | src/promql/src/extension_plan/scalar_calculate.rs:492-501 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/range_manipulate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) src/index/src/fulltext_index/create/bloom_filter.rs:117 — src/index/src/fulltext_index/create/bloom_filter.rs:117-126 | src/mito2/src/sst/index/bloom_filter/creator.rs:497-506 | src/mito2/src/sst/index/inverted_index/creator.rs:431-440 — `src/mito2/src/sst/index/bloom_filter/creator.rs` and `src/mito2/src/sst/index/inverted_index/creator.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/index/src/fulltext_index/create/bloom_filter.rs:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) src/common/meta/src/cache/table/table_info.rs:72 — src/common/meta/src/cache/table/table_info.rs:72-81 | src/common/meta/src/cache/table/table_route.rs:104-113 | src/common/meta/src/cache/table/view_info.rs:64-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/cache/table/table_info.rs:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) src/pipeline/src/etl/processor/decolorize.rs:54 — src/pipeline/src/etl/processor/decolorize.rs:54-63 | src/pipeline/src/etl/processor/digest.rs:115-124 | src/pipeline/src/etl/processor/gsub.rs:52-61 — before extracting anything, compare `src/pipeline/src/etl/processor/decolorize.rs` and `src/pipeline/src/etl/processor/digest.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) src/promql/src/functions/idelta.rs:115 — src/promql/src/functions/idelta.rs:115-124 | src/promql/src/functions/quantile.rs:117-126 | src/promql/src/functions/quantile.rs:164-173 — before extracting anything, compare `src/promql/src/functions/idelta.rs` and `src/promql/src/functions/quantile.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 3) tests-fuzz/src/ir.rs:266 — tests-fuzz/src/ir.rs:266-275 | tests-fuzz/src/ir.rs:279-288 | tests-fuzz/src/ir.rs:292-301 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/src/ir.rs:266` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D2 · Cognitive Complexity · promql · ×6
  • promql::functions::native_histogram::native_extrapolated_rate (cognitive 61) src/promql/src/functions/native_histogram.rs:2467 — promql::functions::native_histogram::native_extrapolated_rate has cognitive complexity 61 (threshold 15). Drivers by points: if/else 28 (50 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • promql::functions::native_histogram::combined_range_float (cognitive 29) src/promql/src/functions/native_histogram.rs:2101 — promql::functions::native_histogram::combined_range_float has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • promql::functions::native_histogram::native_idelta (cognitive 25) src/promql/src/functions/native_histogram.rs:2744 — promql::functions::native_histogram::native_idelta has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • promql::functions::native_histogram::select_mixed_range_lanes (cognitive 23) src/promql/src/functions/native_histogram.rs:1937 — promql::functions::native_histogram::select_mixed_range_lanes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • promql::functions::native_histogram::native_histogram_range_float (cognitive 22) src/promql/src/functions/native_histogram.rs:1191 — promql::functions::native_histogram::native_histogram_range_float has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • promql::extension_plan::local_offset (cognitive 21) src/promql/src/extension_plan.rs:76 — promql::extension_plan::local_offset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cli · ×6
  • cli::data::import_v2::packed::validate_snapshot (cognitive 53) REDACTED:28 — cli::data::import_v2::packed::validate_snapshot has cognitive complexity 53 (threshold 15). Drivers by points: if/else 9 (33 pts), loops 5 (11 pts), match/switch 1 (5 pts), boolean chains 4 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cli::data::import_v2::command::iter_ddl_statements (cognitive 37) src/cli/src/data/import_v2/command.rs:426 — cli::data::import_v2::command::iter_ddl_statements has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (33 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cli::data::export_v2::coordinator::export_data_concurrent (cognitive 26) src/cli/src/data/export_v2/coordinator.rs:169 — cli::data::export_v2::coordinator::export_data_concurrent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 4 (8 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cli::data::export_v2::command::build_verify_plan (cognitive 23) src/cli/src/data/export_v2/command.rs:1212 — cli::data::export_v2::command::build_verify_plan has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), match/switch 2 (6 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cli::data::export_v2::command::verify_snapshot (cognitive 18) src/cli/src/data/export_v2/command.rs:1055 — cli::data::export_v2::command::verify_snapshot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cli::data::import_v2::coordinator::import_tasks_concurrent (cognitive 17) src/cli/src/data/import_v2/coordinator.rs:301 — cli::data::import_v2::coordinator::import_tasks_concurrent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×6
  • Edited copy of a member (26 corresponding lines) src/promql/src/functions/native_histogram.rs:378 — src/promql/src/functions/native_histogram.rs:378-428 | src/promql/src/functions/native_histogram.rs:515-552 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) REDACTED:740 — REDACTED:740-765 | REDACTED:568-596 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) src/metric-engine/src/engine/alter/extract_new_columns.rs:36 — src/metric-engine/src/engine/alter/extract_new_columns.rs:36-67 | src/metric-engine/src/engine/create/extract_new_columns.rs:32-57 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) src/common/meta/src/kv_backend/etcd.rs:163 — src/common/meta/src/kv_backend/etcd.rs:163-188 | src/common/meta/src/kv_backend/etcd.rs:235-265 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) src/cli/src/data/storage_export.rs:124 — src/cli/src/data/storage_export.rs:124-153 | src/cli/src/data/storage_export.rs:276-301 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) src/common/meta/src/state_store.rs:294 — src/common/meta/src/state_store.rs:294-323 | src/common/meta/src/state_store.rs:328-353 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×6
  • Edited copy of a member (23 corresponding lines) src/common/function/src/scalars/string/format.rs:190 — src/common/function/src/scalars/string/format.rs:190-212 | src/common/function/src/scalars/string/space.rs:137-164 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) src/pipeline/src/etl/processor/json_path.rs:133 — src/pipeline/src/etl/processor/json_path.rs:133-155 | src/pipeline/src/etl/processor/simple_extract.rs:104-126 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) .github/scripts/query-regression-slash.py:207 — .github/scripts/query-regression-slash.py:207-229 | .github/scripts/runner_utils.py:27-53 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) src/mito2/src/compaction/picker.rs:63 — src/mito2/src/compaction/picker.rs:63-85 | src/mito2/src/compaction/picker.rs:94-122 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) src/common/macro/src/stack_trace_debug.rs:272 — src/common/macro/src/stack_trace_debug.rs:272-294 | src/common/macro/src/stack_trace_debug.rs:296-318 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) src/servers/src/http/loki.rs:591 — src/servers/src/http/loki.rs:591-616 | src/servers/src/prom_store.rs:782-804 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×6
  • Edited copy of a member (37 corresponding lines) src/mito2/src/cache/index/bloom_filter_index.rs:187 — src/mito2/src/cache/index/bloom_filter_index.rs:187-223 | src/mito2/src/cache/index/inverted_index.rs:163-199 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) src/common/grpc-expr/src/alter.rs:128 — src/common/grpc-expr/src/alter.rs:128-164 | src/store-api/src/region_request.rs:903-943 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) src/mito2/src/cache/file_cache.rs:394 — src/mito2/src/cache/file_cache.rs:394-430 | src/mito2/src/cache/manifest_cache.rs:84-123 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) src/common/function/src/scalars/string/format.rs:116 — src/common/function/src/scalars/string/format.rs:116-162 | src/common/function/src/scalars/string/space.rs:94-130 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) src/store-api/src/metadata.rs:931 — src/store-api/src/metadata.rs:931-972 | src/store-api/src/metadata.rs:974-1010 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) src/mito2/src/series_index/writer.rs:142 — src/mito2/src/series_index/writer.rs:142-179 | src/mito2/src/sst/range_index/writer.rs:134-170 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 9+ corresponding lines) src/cli/src/data/snapshot_storage.rs:562 — src/cli/src/data/snapshot_storage.rs:562-570 | src/cli/src/data/snapshot_storage.rs:602-610 | src/cli/src/data/snapshot_storage.rs:698-706 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) src/catalog/src/system_schema/information_schema/cluster_info.rs:227 — src/catalog/src/system_schema/information_schema/cluster_info.rs:227-235 | src/catalog/src/system_schema/information_schema/procedure_info.rs:169-177 | src/catalog/src/system_schema/information_schema/region_statistics.rs:242-250 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) src/common/meta/src/ddl/event/flow.rs:167 — src/common/meta/src/ddl/event/flow.rs:167-175 | src/common/meta/src/ddl/event/view.rs:226-235 | src/meta-srv/src/event/repartition.rs:134-143 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) src/common/function/src/scalars/primary_key.rs:136 — src/common/function/src/scalars/primary_key.rs:136-144 | src/mito-codec/src/row_converter/dense.rs:419-431 | src/mito-codec/src/row_converter/sparse.rs:296-307 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) src/client/src/region.rs:388 — src/client/src/region.rs:388-401 | src/common/meta/src/ddl/alter_logical_tables/executor.rs:172-180 | src/common/meta/src/ddl/utils/region_metadata_lister.rs:101-111 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) tests-fuzz/src/utils.rs:111 — tests-fuzz/src/utils.rs:111-120 | tests-fuzz/src/utils.rs:123-132 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:419-427 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×6
  • Edited copy of a member (4 corresponding lines) src/common/meta/src/error.rs:1486 — src/common/meta/src/error.rs:1486-1494 | src/common/procedure/src/error.rs:361-364 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) src/common/function/src/scalars/string/insert.rs:161 — src/common/function/src/scalars/string/insert.rs:161-164 | src/common/function/src/scalars/string/locate.rs:185-188 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) src/common/function/src/scalars/string/insert.rs:166 — src/common/function/src/scalars/string/insert.rs:166-169 | src/common/function/src/scalars/string/locate.rs:190-193 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) src/cli/src/metadata/control/put/key.rs:63 — src/cli/src/metadata/control/put/key.rs:63-66 | src/cli/src/metadata/control/put/table.rs:69-72 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) src/meta-client/src/client/config.rs:36 — src/meta-client/src/client/config.rs:36-39 | src/meta-client/src/client/heartbeat.rs:153-156 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) tests-fuzz/targets/ddl/fuzz_create_database.rs:52 — tests-fuzz/targets/ddl/fuzz_create_database.rs:52-55 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:60-63 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×6
  • Duplicated block (15–16 lines × 2) src/common/function/src/scalars/string/insert.rs:56 — src/common/function/src/scalars/string/insert.rs:56-70 | src/common/function/src/scalars/string/locate.rs:55-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/string/insert.rs:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) src/common/meta/src/ddl/truncate_table.rs:199 — src/common/meta/src/ddl/truncate_table.rs:199-214 | src/common/meta/src/ddl/utils.rs:406-420 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/truncate_table.rs:199` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) src/frontend/src/instance/prom_store.rs:635 — src/frontend/src/instance/prom_store.rs:635-650 | src/frontend/src/instance/prom_store.rs:887-901 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/prom_store.rs:635` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) src/mito2/src/read/seq_scan.rs:389 — src/mito2/src/read/seq_scan.rs:389-403 | src/mito2/src/read/unordered_scan.rs:231-246 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/unordered_scan.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/seq_scan.rs:389` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) src/servers/src/postgres/handler.rs:685 — src/servers/src/postgres/handler.rs:685-700 | src/servers/src/postgres/handler.rs:703-717 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/handler.rs:685` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15–16 lines × 2) src/table/src/metadata.rs:924 — src/table/src/metadata.rs:924-939 | src/table/src/metadata.rs:1021-1035 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/table/src/metadata.rs:924` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×6
  • Duplicated block (14–15 lines × 2) src/catalog/src/system_schema/information_schema/flow_statistics.rs:190 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:190-203 | src/catalog/src/system_schema/information_schema/flows.rs:299-313 — before extracting anything, compare `src/catalog/src/system_schema/information_schema/flow_statistics.rs` and `src/catalog/src/system_schema/information_schema/flows.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/catalog/src/system_schema/information_schema/flow_statistics.rs:205` calls `current_time_millis` and `src/catalog/src/system_schema/information_schema/flows.rs:315` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14–15 lines × 2) src/metric-engine/src/engine.rs:594 — src/metric-engine/src/engine.rs:594-607 | src/store-api/src/region_engine.rs:1108-1122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/store-api/src/region_engine.rs:1108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) src/mito2/src/compaction/scheduler.rs:725 — src/mito2/src/compaction/scheduler.rs:725-739 | src/mito2/src/compaction/scheduler/planning.rs:494-507 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) src/query/src/part_sort.rs:1048 — src/query/src/part_sort.rs:1048-1061 | src/query/src/part_sort.rs:1111-1125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/part_sort.rs:1048` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) src/servers/src/otlp/trace/v0.rs:68 — src/servers/src/otlp/trace/v0.rs:68-81 | src/servers/src/otlp/trace/v1.rs:317-331 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14–15 lines × 2) src/sql/src/parsers/alter_parser/trigger.rs:305 — src/sql/src/parsers/alter_parser/trigger.rs:305-319 | src/sql/src/parsers/create_parser/trigger.rs:383-396 — `src/sql/src/parsers/alter_parser/trigger.rs` and `src/sql/src/parsers/create_parser/trigger.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 54 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn parse_trigger_labels( &mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×6
  • Duplicated block (14 lines × 3) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:294 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:294-307 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:278-291 | src/meta-srv/src/procedure/repartition/group/remap_manifest.rs:159-172 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:294` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 3) src/mito2/src/sst/index/bloom_filter/applier.rs:361 — src/mito2/src/sst/index/bloom_filter/applier.rs:361-374 | src/mito2/src/sst/index/fulltext_index/applier.rs:780-793 | src/mito2/src/sst/index/inverted_index/applier.rs:314-327 — `src/mito2/src/sst/index/bloom_filter/applier.rs` and `src/mito2/src/sst/index/fulltext_index/applier.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 40 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/mito2/src/sst/index/bloom_filter/applier.rs:376` calls `target_blob_name` and `src/mito2/src/sst/index/inverted_index/applier.rs:330` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 3) src/mito2/src/sst/index/handler/builtin/bloom.rs:129 — src/mito2/src/sst/index/handler/builtin/bloom.rs:129-142 | src/mito2/src/sst/index/handler/builtin/fulltext.rs:146-159 | src/mito2/src/sst/index/handler/builtin/inverted.rs:190-203 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/handler/builtin/bloom.rs:129` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) src/promql/src/functions/native_histogram.rs:1217 — src/promql/src/functions/native_histogram.rs:1217-1230 | src/promql/src/functions/native_histogram.rs:2506-2519 | src/promql/src/functions/native_histogram.rs:2771-2784 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/native_histogram.rs:1217` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) src/sql/src/parsers/alter_parser/trigger.rs:321 — src/sql/src/parsers/alter_parser/trigger.rs:321-334 | src/sql/src/parsers/alter_parser/trigger.rs:366-379 | src/sql/src/parsers/alter_parser/trigger.rs:411-424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/alter_parser/trigger.rs:321` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) src/promql/src/extension_plan/normalize.rs:144 — src/promql/src/extension_plan/normalize.rs:144-157 | src/promql/src/extension_plan/range_manipulate.rs:386-399 | src/promql/src/extension_plan/scalar_calculate.rs:321-334 — before extracting anything, compare `src/promql/src/extension_plan/range_manipulate.rs` and `src/promql/src/extension_plan/scalar_calculate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/normalize.rs:144` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×6
  • Duplicated block (11 lines × 4) src/catalog/src/system_schema/information_schema/columns.rs:267 — src/catalog/src/system_schema/information_schema/columns.rs:267-277 | src/catalog/src/system_schema/information_schema/key_column_usage.rs:239-249 | src/catalog/src/system_schema/information_schema/statistics.rs:238-248 | src/catalog/src/system_schema/information_schema/table_constraints.rs:182-192 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/columns.rs:267` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) src/servers/src/grpc/flight/stream.rs:252 — src/servers/src/grpc/flight/stream.rs:252-262 | src/servers/src/grpc/flight/stream.rs:322-332 | src/servers/src/grpc/flight/stream.rs:340-350 | src/servers/src/grpc/flight/stream.rs:591-601 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 4) src/common/function/src/scalars/vector/vector_add.rs:64 — src/common/function/src/scalars/vector/vector_add.rs:64-74 | src/common/function/src/scalars/vector/vector_div.rs:65-75 | src/common/function/src/scalars/vector/vector_mul.rs:64-74 | src/common/function/src/scalars/vector/vector_sub.rs:63-73 — before extracting anything, compare `src/common/function/src/scalars/vector/vector_div.rs` and `src/common/function/src/scalars/vector/vector_mul.rs` as WHOLE FILES: 87% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/vector/vector_add.rs:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) src/common/meta/src/region_registry.rs:80 — src/common/meta/src/region_registry.rs:80-90 | src/common/meta/src/region_registry.rs:93-103 | src/store-api/src/region_engine.rs:692-702 | src/store-api/src/region_engine.rs:705-715 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (11 lines × 4) src/meta-client/src/client/config.rs:128 — src/meta-client/src/client/config.rs:128-138 | src/meta-client/src/client/heartbeat.rs:287-297 | src/meta-client/src/client/procedure.rs:185-195 | src/meta-client/src/client/store.rs:271-281 — before extracting anything, compare `src/meta-client/src/client/config.rs` and `src/meta-client/src/client/heartbeat.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 4) src/meta-client/src/client/procedure.rs:278 — src/meta-client/src/client/procedure.rs:278-288 | src/meta-client/src/client/procedure.rs:299-309 | src/meta-client/src/client/procedure.rs:412-422 | src/meta-client/src/client/procedure.rs:460-470 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-client/src/client/procedure.rs:278` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×6
  • Duplicated block (11 lines × 3) src/common/meta/src/ddl_manager.rs:1310 — src/common/meta/src/ddl_manager.rs:1310-1320 | src/common/meta/src/ddl_manager.rs:1543-1553 | src/common/meta/src/ddl_manager.rs:1644-1654 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl_manager.rs:1310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) src/frontend/src/instance/otlp.rs:105 — src/frontend/src/instance/otlp.rs:105-115 | src/frontend/src/instance/otlp.rs:407-417 | src/frontend/src/instance/otlp.rs:445-455 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (11 lines × 3) src/session/src/session_config.rs:119 — src/session/src/session_config.rs:119-129 | src/session/src/session_config.rs:176-186 | src/session/src/session_config.rs:233-243 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/session/src/session_config.rs:119` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) src/common/meta/src/ddl/alter_table/partition_compat.rs:238 — src/common/meta/src/ddl/alter_table/partition_compat.rs:238-248 | src/datatypes/src/value.rs:463-473 | src/partition/src/expr.rs:78-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (11 lines × 3) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:110 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:110-120 | tests-fuzz/targets/fuzz_insert_logical_table.rs:141-151 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:109-119 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 3) tests-integration/src/test_util.rs:1224 — tests-integration/src/test_util.rs:1224-1234 | tests-integration/src/test_util.rs:1281-1291 | tests-integration/src/test_util.rs:1341-1351 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tests-integration/src/test_util.rs:1224` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tests-integration/src/test_util.rs:1223` calls `fe_instance`, `clone` and `tests-integration/src/test_util.rs:1279` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×6
  • Duplicated block (8 lines × 3) src/common/function/src/scalars/geo/measure.rs:69 — src/common/function/src/scalars/geo/measure.rs:69-76 | src/common/function/src/scalars/geo/measure.rs:132-139 | src/common/function/src/scalars/geo/measure.rs:203-210 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/measure.rs:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) src/puffin/src/puffin_manager/stager/bounded_stager.rs:158 — src/puffin/src/puffin_manager/stager/bounded_stager.rs:158-165 | src/puffin/src/puffin_manager/stager/bounded_stager.rs:215-222 | src/puffin/src/puffin_manager/stager/bounded_stager.rs:277-284 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/puffin/src/puffin_manager/stager/bounded_stager.rs:168` calls `now` and `src/puffin/src/puffin_manager/stager/bounded_stager.rs:286` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) src/meta-srv/src/event/gc.rs:120 — src/meta-srv/src/event/gc.rs:120-127 | src/meta-srv/src/event/repartition.rs:121-128 | src/meta-srv/src/event/repartition.rs:330-337 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (8 lines × 3) src/common/function/src/scalars/matches.rs:573 — src/common/function/src/scalars/matches.rs:573-580 | src/common/function/src/scalars/matches.rs:596-603 | src/common/function/src/scalars/matches.rs:619-627 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/matches.rs:573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) src/common/macro/src/row/into_row.rs:28 — src/common/macro/src/row/into_row.rs:28-35 | src/common/macro/src/row/schema.rs:30-37 | src/common/macro/src/row/to_row.rs:28-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/macro/src/row/into_row.rs:28` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 3) src/servers/src/http/result/csv_result.rs:42 — src/servers/src/http/result/csv_result.rs:42-49 | src/servers/src/http/result/json_result.rs:38-45 | src/servers/src/http/result/table_result.rs:39-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http/result/csv_result.rs:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · ParserContext · ×5
  • ParserContext::parse_show (cyclomatic 39) src/sql/src/parsers/show_parser.rs:38 — ParserContext::parse_show has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • ParserContext::parse_statement (cyclomatic 30) src/sql/src/parser.rs:142 — ParserContext::parse_statement has cyclomatic complexity 30 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ParserContext::parse_alter_trigger (cyclomatic 25) src/sql/src/parsers/alter_parser/trigger.rs:65 — ParserContext::parse_alter_trigger has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ParserContext::parse_one_impl (cyclomatic 18) src/common/function/src/scalars/matches.rs:569 — ParserContext::parse_one_impl has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • ParserContext::parse_create_flow (cyclomatic 16) src/sql/src/parsers/create_parser.rs:301 — ParserContext::parse_create_flow has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · pipeline · ×5
  • pipeline::etl::transform::transformer::greptime::coerce::coerce_u64_value (cyclomatic 29) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:344 — pipeline::etl::transform::transformer::greptime::coerce::coerce_u64_value has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pipeline::etl::transform::transformer::greptime::coerce::coerce_i64_value (cyclomatic 25) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:287 — pipeline::etl::transform::transformer::greptime::coerce::coerce_i64_value has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pipeline::etl::transform::transformer::greptime::coerce::coerce_bool_value (cyclomatic 19) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:211 — pipeline::etl::transform::transformer::greptime::coerce::coerce_bool_value has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • pipeline::etl::processor::logfmt::parse_logfmt (cyclomatic 18) src/pipeline/src/etl/processor/logfmt.rs:143 — pipeline::etl::processor::logfmt::parse_logfmt has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • pipeline::etl::processor::logfmt::parse_quoted_value (cyclomatic 17) src/pipeline/src/etl/processor/logfmt.rs:206 — pipeline::etl::processor::logfmt::parse_quoted_value has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D17 · Explicit Debt · HackComment · ×5
  • HackComment src/mito2/src/region.rs:750 — // Hack(zhongzc): If we have just become leader (writable), persist any backfilled metadata. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/datanode/src/region_server.rs:1395 — /// HACK(zhongzc): Direct MitoEngine handle for diagnostics. This couples the — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/common/meta/src/kv_backend/chroot.rs:271 — // one-sided range (HACK - b'/' + 1 = b'0') — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/common/meta/src/kv_backend/txn.rs:132 — // HACK - chroot would modify this field — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment src/common/error/src/lib.rs:24 — // HACK - these headers are here for shared in gRPC services. For common HTTP headers, — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · partition · ×5
  • partition::simplify::simplify_terms (cognitive 39) src/partition/src/simplify.rs:297 — partition::simplify::simplify_terms has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 7 (15 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • partition::subtask::create_subtasks (cognitive 31) src/partition/src/subtask.rs:32 — partition::subtask::create_subtasks has cognitive complexity 31 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 4 (13 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • partition::overlap::atomic_exprs_overlap (cognitive 23) src/partition/src/overlap.rs:31 — partition::overlap::atomic_exprs_overlap has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (13 pts), boolean chains 5, if/else 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
  • partition::utils::split::is_empty_and_conjunction (cognitive 23) src/partition/src/utils/split.rs:121 — partition::utils::split::is_empty_and_conjunction has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • partition::utils::split::collect_conjunction_bounds (cognitive 16) src/partition/src/utils/split.rs:567 — partition::utils::split::collect_conjunction_bounds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×5
  • Edited copy of a member (33 corresponding lines) src/mito2/src/read/flat_merge.rs:862 — src/mito2/src/read/flat_merge.rs:862-894 | src/mito2/src/read/flat_merge.rs:1039-1075 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) src/mito2/src/sst/index/handler/builtin/bloom.rs:49 — src/mito2/src/sst/index/handler/builtin/bloom.rs:49-81 | src/mito2/src/sst/index/handler/builtin/fulltext.rs:50-91 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) src/common/function/src/scalars/string/insert.rs:55 — src/common/function/src/scalars/string/insert.rs:55-87 | src/common/function/src/scalars/string/locate.rs:53-94 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) src/operator/src/statement/set.rs:70 — src/operator/src/statement/set.rs:70-106 | src/operator/src/statement/set.rs:108-140 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) src/metric-engine/src/engine/put.rs:453 — src/metric-engine/src/engine/put.rs:453-485 | src/metric-engine/src/engine/put.rs:491-523 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×5
  • Edited copy of a member (25 corresponding lines) src/common/function/src/scalars/geo/s2.rs:82 — src/common/function/src/scalars/geo/s2.rs:82-117 | src/common/function/src/scalars/geo/wkt.rs:74-98 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) src/common/meta/src/key/table_repart.rs:281 — src/common/meta/src/key/table_repart.rs:281-305 | src/common/meta/src/key/table_route.rs:745-769 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) src/datatypes/src/arrow_array.rs:145 — src/datatypes/src/arrow_array.rs:145-169 | src/datatypes/src/arrow_array.rs:180-206 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) src/file-engine/src/engine.rs:368 — src/file-engine/src/engine.rs:368-392 | src/relational-engine/src/engine.rs:369-396 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) src/common/meta/src/ddl_manager.rs:683 — src/common/meta/src/ddl_manager.rs:683-714 | src/common/meta/src/ddl_manager.rs:750-774 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×5
  • Edited copy of a member (31 corresponding lines) src/sql/src/parsers/alter_parser/trigger.rs:349 — src/sql/src/parsers/alter_parser/trigger.rs:349-379 | src/sql/src/parsers/alter_parser/trigger.rs:394-424 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) src/cmd/src/bin/query_regression_runner/otlp.rs:329 — src/cmd/src/bin/query_regression_runner/otlp.rs:329-361 | src/cmd/src/bin/query_regression_runner/remote/ingest.rs:426-456 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) src/mito2/src/read/compat.rs:435 — src/mito2/src/read/compat.rs:435-465 | src/mito2/src/read/compat.rs:592-626 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) src/common/datasource/src/file_format/csv.rs:162 — src/common/datasource/src/file_format/csv.rs:162-197 | src/common/datasource/src/file_format/json.rs:90-120 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) src/store-api/src/metadata.rs:1012 — src/store-api/src/metadata.rs:1012-1044 | src/store-api/src/metadata.rs:1046-1076 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 14+ corresponding lines) src/catalog/src/system_schema/information_schema/region_peers.rs:307 — src/catalog/src/system_schema/information_schema/region_peers.rs:307-320 | src/catalog/src/system_schema/information_schema/table_semantics.rs:404-419 | src/catalog/src/system_schema/information_schema/views.rs:261-275 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) src/common/time/src/duration.rs:201 — src/common/time/src/duration.rs:201-214 | src/common/time/src/time.rs:189-202 | src/common/time/src/timestamp.rs:723-736 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) src/mito2/src/read/range_cache.rs:188 — src/mito2/src/read/range_cache.rs:188-201 | src/mito2/src/read/range_cache.rs:203-216 | src/mito2/src/read/range_cache.rs:218-231 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) src/meta-client/src/client/cluster.rs:226 — src/meta-client/src/client/cluster.rs:226-239 | src/meta-client/src/client/cluster.rs:241-260 | src/meta-client/src/client/cluster.rs:262-279 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) src/common/meta/src/key/flow/flow_name.rs:206 — src/common/meta/src/key/flow/flow_name.rs:206-220 | src/common/meta/src/key/flow/flownode_flow.rs:184-197 | src/common/meta/src/key/table_name.rs:284-297 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 16+ corresponding lines) src/catalog/src/system_schema/information_schema/partitions.rs:233 — src/catalog/src/system_schema/information_schema/partitions.rs:233-248 | src/catalog/src/system_schema/information_schema/table_semantics.rs:303-320 | src/catalog/src/system_schema/information_schema/views.rs:172-188 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) src/common/meta/src/ddl/alter_database.rs:204 — src/common/meta/src/ddl/alter_database.rs:204-219 | src/common/meta/src/ddl/create_database.rs:281-297 | src/common/meta/src/ddl/drop_database.rs:177-192 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) src/sql/src/parsers/alter_parser/trigger.rs:490 — src/sql/src/parsers/alter_parser/trigger.rs:490-505 | src/sql/src/parsers/alter_parser/trigger.rs:510-527 | src/sql/src/parsers/alter_parser/trigger.rs:532-547 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) src/mito2/src/sst/version.rs:153 — src/mito2/src/sst/version.rs:153-168 | src/mito2/src/sst/version.rs:195-210 | src/mito2/src/sst/version.rs:213-228 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) src/meta-srv/src/service/admin/datanode.rs:107 — src/meta-srv/src/service/admin/datanode.rs:107-122 | src/meta-srv/src/service/admin/datanode.rs:129-145 | src/meta-srv/src/service/admin/datanode.rs:152-168 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×5
  • Edited copy of a member (5 corresponding lines) src/common/recordbatch/src/lib.rs:379 — src/common/recordbatch/src/lib.rs:379-383 | src/common/recordbatch/src/util.rs:36-40 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) src/common/meta/src/key/flow/flow_name.rs:223 — src/common/meta/src/key/flow/flow_name.rs:223-227 | src/common/meta/src/key/table_info.rs:196-200 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) src/meta-client/src/client/config.rs:46 — src/meta-client/src/client/config.rs:46-50 | src/meta-client/src/client/heartbeat.rs:171-175 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) src/meta-srv/src/gc/scheduler.rs:166 — src/meta-srv/src/gc/scheduler.rs:166-170 | src/meta-srv/src/region/flush_trigger.rs:160-164 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) src/mito2/src/cache/index.rs:234 — src/mito2/src/cache/index.rs:234-238 | src/mito2/src/sst/parquet/push_decoder.rs:288-292 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×5
  • Duplicated block (24 lines × 2) src/cmd/src/datanode/objbench.rs:220 — src/cmd/src/datanode/objbench.rs:220-243 | src/cmd/src/datanode/parquetbench.rs:311-334 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/datanode/objbench.rs:220` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (24 lines × 2) src/mito2/src/cache/index/bloom_filter_index.rs:200 — src/mito2/src/cache/index/bloom_filter_index.rs:200-223 | src/mito2/src/cache/index/inverted_index.rs:176-199 — before extracting anything, compare `src/mito2/src/cache/index/bloom_filter_index.rs` and `src/mito2/src/cache/index/inverted_index.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/cache/index/bloom_filter_index.rs:200` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) src/promql/src/functions/native_histogram.rs:383 — src/promql/src/functions/native_histogram.rs:383-406 | src/promql/src/functions/native_histogram.rs:520-543 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/native_histogram.rs:383` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) src/table/src/metadata.rs:1366 — src/table/src/metadata.rs:1366-1389 | src/table/src/metadata.rs:1409-1432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/table/src/metadata.rs:1366` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:352 — src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:352-375 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:311-334 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` and `src/meta-srv/src/procedure/repartition/group/sync_region.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:352` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) REDACTED:745 — REDACTED:745-765 | REDACTED:576-596 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:745` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) src/common/meta/src/key/table_repart.rs:285 — src/common/meta/src/key/table_repart.rs:285-305 | src/common/meta/src/key/table_route.rs:749-769 — before extracting anything, compare `src/common/meta/src/key/table_repart.rs` and `src/common/meta/src/key/table_route.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/table_repart.rs:285` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) src/query/src/promql/planner.rs:1264 — src/query/src/promql/planner.rs:1264-1284 | src/query/src/promql/planner.rs:1331-1351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:1264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) src/table/src/metadata.rs:567 — src/table/src/metadata.rs:567-587 | src/table/src/metadata.rs:627-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/table/src/metadata.rs:567` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `requests` to `&[SetIndexOption]` in one and `&[UnsetIndexOption]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (21 lines × 2) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:166 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:166-186 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:165-185 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 230 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:166` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×5
  • Duplicated block (17–18 lines × 2) REDACTED:717 — REDACTED:717-733 | REDACTED:544-561 — before extracting anything, compare `REDACTED` and `REDACTED` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:717` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–18 lines × 2) src/mito2/src/cache/index/bloom_filter_index.rs:133 — src/mito2/src/cache/index/bloom_filter_index.rs:133-150 | src/mito2/src/cache/index/bloom_filter_index.rs:165-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/cache/index/bloom_filter_index.rs:133` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–18 lines × 2) src/servers/src/otlp/trace/v1.rs:65 — src/servers/src/otlp/trace/v1.rs:65-82 | src/servers/src/otlp/trace/v2.rs:61-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/otlp/trace/v1.rs:65` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (17–18 lines × 2) tests-fuzz/targets/ddl/fuzz_repartition_table.rs:141 — tests-fuzz/targets/ddl/fuzz_repartition_table.rs:141-158 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:164-180 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_repartition_table.rs` and `tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_repartition_table.rs:141` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17–18 lines × 2) tests-integration/src/test_util.rs:1273 — tests-integration/src/test_util.rs:1273-1290 | tests-integration/src/test_util.rs:1334-1350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tests-integration/src/test_util.rs:1273` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×5
  • Duplicated block (9–10 lines × 2) src/datanode/src/service.rs:80 — src/datanode/src/service.rs:80-89 | src/flow/src/server.rs:429-437 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/datanode/src/service.rs:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/datanode/src/service.rs:79` calls `with_greptime_config_options`, `to_toml`, `context` and `src/flow/src/server.rs:428` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9–10 lines × 2) src/datatypes/src/data_type.rs:206 — src/datatypes/src/data_type.rs:206-215 | src/servers/src/postgres/copy_in/csv.rs:93-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9–10 lines × 2) src/query/src/promql/planner.rs:1746 — src/query/src/promql/planner.rs:1746-1754 | src/query/src/promql/planner.rs:6590-6599 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:1746` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:178 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:178-187 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:249-257 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_alter_table.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:178` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:81 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:81-89 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:79-88 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 230 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:81` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×5
  • Duplicated block (7–8 lines × 2) src/common/procedure/src/error.rs:257 — src/common/procedure/src/error.rs:257-264 | src/common/procedure/src/error.rs:301-307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7–8 lines × 2) src/mito2/src/read/series_reader.rs:342 — src/mito2/src/read/series_reader.rs:342-348 | src/mito2/src/read/series_scan.rs:773-780 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) src/servers/src/mysql/handler.rs:987 — src/servers/src/mysql/handler.rs:987-994 | src/servers/src/mysql/handler.rs:1018-1024 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/mysql/handler.rs:987` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) src/query/src/dist_plan/merge_scan.rs:1130 — src/query/src/dist_plan/merge_scan.rs:1130-1137 | src/query/src/dist_plan/merge_scan.rs:1144-1150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/dist_plan/merge_scan.rs:1130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) src/common/meta/src/kv_backend/test.rs:511 — src/common/meta/src/kv_backend/test.rs:511-517 | src/common/meta/src/kv_backend/test.rs:540-547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/kv_backend/test.rs:511` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · operator · ×4
  • operator::req_convert::common::push_column_to_rows (cyclomatic 94) src/operator/src/req_convert/common.rs:202 — operator::req_convert::common::push_column_to_rows has cyclomatic complexity 94 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • operator::expr_helper::to_alter_table_expr (cyclomatic 24) src/operator/src/expr_helper.rs:830 — operator::expr_helper::to_alter_table_expr has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • operator::statement::semantic_graph::conventions::validate (cyclomatic 22) src/operator/src/statement/semantic_graph/conventions.rs:173 — operator::statement::semantic_graph::conventions::validate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • operator::insert::fill_table_options_for_create (cyclomatic 20) src/operator/src/insert.rs:2362 — operator::insert::fill_table_options_for_create has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StatementExecutor · ×4
  • StatementExecutor::execute_sql (cyclomatic 57) src/operator/src/statement.rs:248 — StatementExecutor::execute_sql has cyclomatic complexity 57 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • StatementExecutor::determine_flow_type (cyclomatic 19) src/operator/src/statement/ddl.rs:980 — StatementExecutor::determine_flow_type has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • StatementExecutor::set_variables (cyclomatic 18) src/operator/src/statement.rs:567 — StatementExecutor::set_variables has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • StatementExecutor::repartition_table (cyclomatic 16) src/operator/src/statement/ddl.rs:1814 — StatementExecutor::repartition_table has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D2 · Cognitive Complexity · Inserter · ×4
  • Inserter::create_or_alter_tables_on_demand (cognitive 135) src/operator/src/insert.rs:1284 — Inserter::create_or_alter_tables_on_demand has cognitive complexity 135 (threshold 15). Drivers by points: if/else 36 (89 pts), loops 12 (29 pts), boolean chains 11, match/switch 3 (6 pts) (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inserter::validate_and_normalize_otlp_metrics (cognitive 49) src/operator/src/insert/otlp.rs:75 — Inserter::validate_and_normalize_otlp_metrics has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 6 (11 pts), match/switch 3 (7 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inserter::get_alter_table_expr_on_demand (cognitive 40) src/operator/src/insert.rs:1878 — Inserter::get_alter_table_expr_on_demand has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 5, match/switch 1 (4 pts), loops 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inserter::handle_bulk_insert (cognitive 17) src/operator/src/bulk_insert.rs:121 — Inserter::handle_bulk_insert has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchingTask · ×4
  • BatchingTask::apply_query_result_to_state (cognitive 44) src/flow/src/batching_mode/task/ckpt.rs:91 — BatchingTask::apply_query_result_to_state has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (42 pts), match/switch 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BatchingTask::execute_plan_unlocked (cognitive 35) src/flow/src/batching_mode/task.rs:1233 — BatchingTask::execute_plan_unlocked has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 6, match/switch 3 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • BatchingTask::start_scheduled_loop (cognitive 33) src/flow/src/batching_mode/task.rs:1691 — BatchingTask::start_scheduled_loop has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 7 (15 pts), loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BatchingTask::capture_recovery_windows_since (cognitive 16) src/flow/src/batching_mode/task.rs:743 — BatchingTask::capture_recovery_windows_since has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · HistogramFoldStream · ×4
  • HistogramFoldStream::evaluate_row (cognitive 38) src/promql/src/extension_plan/histogram_fold.rs:1240 — HistogramFoldStream::evaluate_row has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 6, loops 2 (4 pts), match/switch 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HistogramFoldStream::evaluate_fraction (cognitive 33) src/promql/src/extension_plan/histogram_fold.rs:1359 — HistogramFoldStream::evaluate_fraction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 9, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HistogramFoldStream::finalize_safe_group (cognitive 22) src/promql/src/extension_plan/histogram_fold.rs:1047 — HistogramFoldStream::finalize_safe_group has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HistogramFoldStream::process_safe_mode_buffer (cognitive 19) src/promql/src/extension_plan/histogram_fold.rs:1114 — HistogramFoldStream::process_safe_mode_buffer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pipeline · ×4
  • pipeline::etl::processor::logfmt::parse_logfmt (cognitive 34) src/pipeline/src/etl/processor/logfmt.rs:143 — pipeline::etl::processor::logfmt::parse_logfmt has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (8 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • pipeline::etl::parse_with_options (cognitive 19) src/pipeline/src/etl.rs:67 — pipeline::etl::parse_with_options has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pipeline::etl::transform::transformer::greptime::coerce::coerce_u64_value (cognitive 19) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:344 — pipeline::etl::transform::transformer::greptime::coerce::coerce_u64_value has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 12 (19 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • pipeline::etl::transform::transformer::greptime::values_to_rows (cognitive 16) src/pipeline/src/etl/transform/transformer/greptime.rs:580 — pipeline::etl::transform::transformer::greptime::values_to_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cmd · ×4
  • cmd::bin::query_regression_runner::measure::run_target (cognitive 26) src/cmd/src/bin/query_regression_runner/measure.rs:129 — cmd::bin::query_regression_runner::measure::run_target has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cmd::datanode::parquet_rewrite::build_writer_properties (cognitive 24) src/cmd/src/datanode/parquet_rewrite.rs:265 — cmd::datanode::parquet_rewrite::build_writer_properties has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • cmd::bin::query_regression_runner::sql::extract_rows::visit (cognitive 19) src/cmd/src/bin/query_regression_runner/sql.rs:27 — cmd::bin::query_regression_runner::sql::extract_rows::visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • cmd::bin::query_regression_runner::remote::storage::enforce_storage_thresholds (cognitive 18) src/cmd/src/bin/query_regression_runner/remote/storage.rs:93 — cmd::bin::query_regression_runner::remote::storage::enforce_storage_thresholds has cognitive complexity 18 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 3 (6 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D35 · Change Coupling · Change-coupling hub · ×4
  • Change-coupling hub: unordered_scan.rs → range.rs, seq_scan.rs, series_scan.rs src/mito2/src/read/unordered_scan.rs — `src/mito2/src/read/unordered_scan.rs` changes together with 3 other files — `src/mito2/src/read/range.rs`, `src/mito2/src/read/seq_scan.rs`, `src/mito2/src/read/series_scan.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: collect_leader_region_handler.rs → failure_handler.rs, persist_stats_handler.rs, region_lease_handler.rs, weight_compute.rs src/meta-srv/src/handler/collect_leader_region_handler.rs — `src/meta-srv/src/handler/collect_leader_region_handler.rs` changes together with 4 other files — `src/meta-srv/src/handler/failure_handler.rs`, `src/meta-srv/src/handler/persist_stats_handler.rs`, `src/meta-srv/src/handler/region_lease_handler.rs`, `src/meta-srv/src/selector/weight_compute.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: finish.rs → access_layer.rs, write_cache.rs, compactor.rs, flush.rs src/mito2/src/sst/index/indexer/finish.rs — `src/mito2/src/sst/index/indexer/finish.rs` changes together with 4 other files — `src/mito2/src/access_layer.rs`, `src/mito2/src/cache/write_cache.rs`, `src/mito2/src/compaction/compactor.rs`, `src/mito2/src/flush.rs` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: metrics.rs → ddl.rs, ddl_manager.rs, error.rs src/common/meta/src/metrics.rs — `src/common/meta/src/metrics.rs` changes together with 3 other files — `src/common/meta/src/ddl.rs`, `src/common/meta/src/ddl_manager.rs`, `src/common/meta/src/error.rs` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×4
  • Edited copy of a member (38 corresponding lines) src/store-api/src/region_info.rs:88 — src/store-api/src/region_info.rs:88-125 | src/store-api/src/sst_entry.rs:450-489 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) src/common/function/src/aggrs/geo/encoding.rs:102 — src/common/function/src/aggrs/geo/encoding.rs:102-139 | src/common/function/src/aggrs/geo/geo_path.rs:124-161 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) src/meta-client/src/client/procedure.rs:322 — src/meta-client/src/client/procedure.rs:322-359 | src/meta-client/src/client/procedure.rs:365-404 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) src/mito2/src/access_layer.rs:266 — src/mito2/src/access_layer.rs:266-307 | src/mito2/src/access_layer.rs:312-349 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×4
  • Edited copy of a member (43 corresponding lines) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:211 — src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:211-258 | src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:413-455 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) src/common/function/src/scalars/anomaly/mad.rs:100 — src/common/function/src/scalars/anomaly/mad.rs:100-148 | src/common/function/src/scalars/anomaly/zscore.rs:92-134 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) src/common/macro/src/row/into_row.rs:46 — src/common/macro/src/row/into_row.rs:46-88 | src/common/macro/src/row/to_row.rs:46-88 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) src/cli/src/metadata/control/put/table.rs:99 — src/cli/src/metadata/control/put/table.rs:99-141 | src/cli/src/metadata/control/put/table.rs:189-241 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×4
  • Edited copy of a member (52 corresponding lines) src/catalog/src/system_schema/information_schema/flows.rs:135 — src/catalog/src/system_schema/information_schema/flows.rs:135-186 | src/query/src/sql.rs:1284-1338 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) src/meta-client/src/client/cluster.rs:173 — src/meta-client/src/client/cluster.rs:173-224 | src/meta-client/src/client/procedure.rs:207-258 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) src/common/function/src/admin/reconcile_catalog.rs:54 — src/common/function/src/admin/reconcile_catalog.rs:54-105 | src/common/function/src/admin/reconcile_database.rs:56-114 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) src/sql/src/parsers/create_parser/trigger.rs:161 — src/sql/src/parsers/create_parser/trigger.rs:161-217 | src/sql/src/parsers/create_parser/trigger.rs:316-367 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 20+ corresponding lines) src/store-api/src/compaction_task.rs:125 — src/store-api/src/compaction_task.rs:125-148 | src/store-api/src/region_info.rs:66-85 | src/store-api/src/sst_entry.rs:427-447 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) src/promql/src/functions/native_histogram.rs:433 — src/promql/src/functions/native_histogram.rs:433-452 | src/promql/src/functions/native_histogram.rs:454-476 | src/promql/src/functions/native_histogram.rs:484-510 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) src/mito2/src/sst/parquet/format.rs:419 — src/mito2/src/sst/parquet/format.rs:419-438 | src/mito2/src/sst/parquet/format.rs:445-464 | src/mito2/src/sst/parquet/format.rs:471-490 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) src/common/meta/src/reconciliation/reconcile_catalog.rs:224 — src/common/meta/src/reconciliation/reconcile_catalog.rs:224-243 | src/common/meta/src/reconciliation/reconcile_database.rs:272-293 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:259-278 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×4
  • Edited copy of a member (34 corresponding lines) src/client/src/database.rs:886 — src/client/src/database.rs:886-921 | src/client/src/region.rs:106-139 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) src/mito2/src/cache/file_cache.rs:445 — src/mito2/src/cache/file_cache.rs:445-478 | src/mito2/src/cache/file_cache.rs:485-519 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) src/meta-srv/src/procedure/repartition.rs:188 — src/meta-srv/src/procedure/repartition.rs:188-221 | src/meta-srv/src/procedure/repartition/group.rs:73-116 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) src/cmd/src/datanode/parquetbench.rs:828 — src/cmd/src/datanode/parquetbench.rs:828-861 | src/cmd/src/datanode/parquetbench.rs:866-902 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 19+ corresponding lines) src/common/macro/src/row/into_row.rs:26 — src/common/macro/src/row/into_row.rs:26-44 | src/common/macro/src/row/schema.rs:28-46 | src/common/macro/src/row/to_row.rs:26-44 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) src/common/meta/src/ddl/create_table.rs:305 — src/common/meta/src/ddl/create_table.rs:305-324 | src/common/meta/src/ddl/drop_database/executor.rs:68-86 | src/common/meta/src/ddl/drop_table.rs:160-183 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) tests-fuzz/targets/ddl/fuzz_alter_table.rs:80 — tests-fuzz/targets/ddl/fuzz_alter_table.rs:80-98 | tests-fuzz/targets/ddl/fuzz_create_table.rs:69-89 | tests-fuzz/targets/fuzz_insert.rs:88-106 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) tests-fuzz/src/generator/alter_expr.rs:39 — tests-fuzz/src/generator/alter_expr.rs:39-61 | tests-fuzz/src/ir.rs:488-506 | tests-fuzz/src/ir.rs:512-532 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 18+ corresponding lines) src/common/meta/src/key/flow/flow_info.rs:450 — src/common/meta/src/key/flow/flow_info.rs:450-467 | src/common/meta/src/key/flow/flow_name.rs:264-281 | src/common/meta/src/state_store.rs:264-281 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) src/common/procedure-test/src/lib.rs:83 — src/common/procedure-test/src/lib.rs:83-101 | src/common/procedure-test/src/lib.rs:110-129 | src/common/procedure-test/src/lib.rs:138-155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) src/servers/src/http/result/csv_result.rs:40 — src/servers/src/http/result/csv_result.rs:40-61 | src/servers/src/http/result/json_result.rs:36-53 | src/servers/src/http/result/table_result.rs:37-54 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:210 — tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:210-232 | tests-fuzz/targets/ddl/fuzz_repartition_table.rs:182-207 | tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:182-199 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 11+ corresponding lines) src/common/meta/src/ddl/drop_table.rs:405 — src/common/meta/src/ddl/drop_table.rs:405-416 | src/common/meta/src/ddl/drop_view.rs:204-214 | src/common/meta/src/ddl/truncate_table.rs:80-90 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) src/common/meta/src/kv_backend/chroot.rs:64 — src/common/meta/src/kv_backend/chroot.rs:64-74 | src/common/meta/src/kv_backend/chroot.rs:83-94 | src/common/meta/src/kv_backend/chroot.rs:124-134 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) src/promql/src/extension_plan/normalize.rs:89 — src/promql/src/extension_plan/normalize.rs:89-99 | src/promql/src/extension_plan/scalar_calculate.rs:278-289 | src/promql/src/extension_plan/series_divide.rs:182-192 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) src/cmd/src/datanode.rs:287 — src/cmd/src/datanode.rs:287-298 | src/cmd/src/frontend.rs:247-257 | src/cmd/src/standalone.rs:393-404 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 8+ corresponding lines) src/mito2/src/sst/parquet/stats.rs:146 — src/mito2/src/sst/parquet/stats.rs:146-153 | src/mito2/src/sst/parquet/stats.rs:155-162 | src/mito2/src/sst/parquet/stats.rs:168-175 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) src/sql/src/statements/create.rs:343 — src/sql/src/statements/create.rs:343-350 | src/sql/src/statements/create.rs:352-361 | src/sql/src/statements/create.rs:363-370 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) src/common/function/src/aggrs/vector/avg.rs:167 — src/common/function/src/aggrs/vector/avg.rs:167-174 | src/common/function/src/aggrs/vector/product.rs:171-178 | src/common/function/src/aggrs/vector/sum.rs:170-177 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) src/common/meta/src/ddl/event/database.rs:191 — src/common/meta/src/ddl/event/database.rs:191-198 | src/common/meta/src/ddl/event/view.rs:160-169 | src/common/meta/src/reconciliation/event.rs:75-83 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×4
  • Duplicated block (13–14 lines × 2) src/cmd/src/datanode/parquetbench.rs:740 — src/cmd/src/datanode/parquetbench.rs:740-752 | src/cmd/src/datanode/parquetbench.rs:810-823 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/datanode/parquetbench.rs:740` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) src/flow/src/batching_mode/frontend_client.rs:611 — src/flow/src/batching_mode/frontend_client.rs:611-623 | src/flow/src/batching_mode/frontend_client.rs:698-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/frontend_client.rs:611` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/flow/src/batching_mode/frontend_client.rs:624` calls `channel` and `src/flow/src/batching_mode/frontend_client.rs:712` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13–14 lines × 2) src/meta-srv/src/procedure/repartition.rs:768 — src/meta-srv/src/procedure/repartition.rs:768-780 | src/meta-srv/src/procedure/repartition/group.rs:223-236 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition.rs:768` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13–14 lines × 2) src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:202 — src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:202-214 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:182-195 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` and `src/meta-srv/src/procedure/repartition/group/sync_region.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:202` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×4
  • Duplicated block (11–13 lines × 2) src/frontend/src/instance/grpc.rs:145 — src/frontend/src/instance/grpc.rs:145-157 | src/frontend/src/instance/grpc.rs:526-536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/grpc.rs:145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–13 lines × 2) src/frontend/src/instance/otlp/trace_ingest.rs:1631 — src/frontend/src/instance/otlp/trace_ingest.rs:1631-1643 | src/frontend/src/instance/otlp/trace_ingest.rs:1718-1728 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/otlp/trace_ingest.rs:1631` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11–13 lines × 2) src/query/src/dist_plan/analyzer.rs:1024 — src/query/src/dist_plan/analyzer.rs:1024-1034 | src/query/src/dist_plan/analyzer.rs:1044-1056 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/dist_plan/analyzer.rs:1044` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11–13 lines × 2) src/query/src/sql.rs:729 — src/query/src/sql.rs:729-741 | src/query/src/sql.rs:1152-1162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/sql.rs:729` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×4
  • Duplicated block (10–12 lines × 2) src/catalog/src/system_schema/information_schema/region_peers.rs:190 — src/catalog/src/system_schema/information_schema/region_peers.rs:190-201 | src/catalog/src/system_schema/information_schema/tables.rs:257-266 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10–12 lines × 2) src/common/procedure/src/local/runner.rs:382 — src/common/procedure/src/local/runner.rs:382-391 | src/common/procedure/src/local/runner.rs:396-407 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/procedure/src/local/runner.rs:396` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) src/query/src/part_sort.rs:1134 — src/query/src/part_sort.rs:1134-1143 | src/query/src/part_sort.rs:1152-1163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10–12 lines × 2) src/sql/src/statements/alter.rs:284 — src/sql/src/statements/alter.rs:284-295 | src/sql/src/statements/alter.rs:422-431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×4
  • Duplicated block (10–11 lines × 2) src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:190 — src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:190-199 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:170-180 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` and `src/meta-srv/src/procedure/repartition/group/sync_region.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 154 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:190` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10–11 lines × 2) src/mito2/src/manifest/storage/checkpoint.rs:125 — src/mito2/src/manifest/storage/checkpoint.rs:125-135 | src/mito2/src/manifest/storage/checkpoint.rs:171-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/manifest/storage/checkpoint.rs:125` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) src/promql/src/functions/native_histogram.rs:1143 — src/promql/src/functions/native_histogram.rs:1143-1152 | src/promql/src/functions/native_histogram.rs:2780-2790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/native_histogram.rs:1143` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) src/servers/src/grpc/flight/stream.rs:229 — src/servers/src/grpc/flight/stream.rs:229-238 | src/servers/src/grpc/flight/stream.rs:613-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/grpc/flight/stream.rs:613` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×4
  • Duplicated block (5 lines × 4) src/common/function/src/scalars/geo/geohash.rs:102 — src/common/function/src/scalars/geo/geohash.rs:102-106 | src/common/function/src/scalars/geo/geohash.rs:203-207 | src/common/function/src/scalars/geo/h3.rs:110-114 | src/common/function/src/scalars/geo/h3.rs:201-205 — before extracting anything, compare `src/common/function/src/scalars/geo/geohash.rs` and `src/common/function/src/scalars/geo/h3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/geohash.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) src/common/meta/src/key/flow/flow_info.rs:366 — src/common/meta/src/key/flow/flow_info.rs:366-370 | src/common/meta/src/key/flow/flow_route.rs:162-166 | src/common/meta/src/key/flow/table_flow.rs:181-185 | src/common/meta/src/key/table_repart.rs:146-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (5 lines × 4) tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:204 — tests-fuzz/targets/ddl/fuzz_repartition_table_chaos.rs:204-208 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:113-117 | tests-fuzz/targets/fuzz_insert_logical_table.rs:144-148 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:112-116 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 4) tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:89 — tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:89-93 | tests-fuzz/targets/fuzz_insert.rs:72-76 | tests-fuzz/targets/fuzz_insert_logical_table.rs:73-77 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:85-89 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D1 · Cyclomatic Complexity · Inserter · ×3
  • Inserter::create_or_alter_tables_on_demand (cyclomatic 61) src/operator/src/insert.rs:1284 — Inserter::create_or_alter_tables_on_demand has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Inserter::validate_and_normalize_otlp_metrics (cyclomatic 30) src/operator/src/insert/otlp.rs:75 — Inserter::validate_and_normalize_otlp_metrics has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Inserter::get_alter_table_expr_on_demand (cyclomatic 21) src/operator/src/insert.rs:1878 — Inserter::get_alter_table_expr_on_demand has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · promql · ×3
  • promql::functions::native_histogram::native_extrapolated_rate (cyclomatic 31) src/promql/src/functions/native_histogram.rs:2467 — promql::functions::native_histogram::native_extrapolated_rate has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • promql::functions::native_histogram::select_mixed_range_lanes (cyclomatic 20) src/promql/src/functions/native_histogram.rs:1937 — promql::functions::native_histogram::select_mixed_range_lanes has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MixedRangeFunction::parse (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
  • promql::functions::native_histogram::native_histogram_range_float (cyclomatic 16) src/promql/src/functions/native_histogram.rs:1191 — promql::functions::native_histogram::native_histogram_range_float has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: MixedRangeFunction::parse (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · NativeHistogram · ×3
  • NativeHistogram::fraction_with_info (cyclomatic 30) src/common/query/src/native_histogram.rs:774 — NativeHistogram::fraction_with_info has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • NativeHistogram::quantile_with_info (cyclomatic 27) src/common/query/src/native_histogram.rs:688 — NativeHistogram::quantile_with_info has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • NativeHistogram::detect_reset (cyclomatic 16) src/common/query/src/native_histogram.rs:555 — NativeHistogram::detect_reset has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Instance · ×3
  • Instance::ingest_trace_spans (cyclomatic 29) src/frontend/src/instance/otlp/trace_ingest.rs:1042 — Instance::ingest_trace_spans has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Instance::do_query (cyclomatic 23) src/frontend/src/instance/grpc.rs:65 — Instance::do_query has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • Instance::reconcile_trace_column_types (cyclomatic 19) src/frontend/src/instance/otlp/trace_ingest.rs:2257 — Instance::reconcile_trace_column_types has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BatchingTask · ×3
  • BatchingTask::execute_plan_unlocked (cyclomatic 24) src/flow/src/batching_mode/task.rs:1233 — BatchingTask::execute_plan_unlocked has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • BatchingTask::apply_query_result_to_state (cyclomatic 18) src/flow/src/batching_mode/task/ckpt.rs:91 — BatchingTask::apply_query_result_to_state has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • BatchingTask::start_scheduled_loop (cyclomatic 18) src/flow/src/batching_mode/task.rs:1691 — BatchingTask::start_scheduled_loop has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · StartCommand · ×3
  • StartCommand::merge_with_cli_options (cyclomatic 19) src/cmd/src/datanode.rs:302 — StartCommand::merge_with_cli_options has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • StartCommand::merge_with_cli_options (cyclomatic 19) src/cmd/src/frontend.rs:260 — StartCommand::merge_with_cli_options has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • StartCommand::merge_with_cli_options (cyclomatic 17) src/cmd/src/metasrv.rs:226 — StartCommand::merge_with_cli_options has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · NativeHistogram · ×3
  • NativeHistogram::quantile_with_info (cognitive 41) src/common/query/src/native_histogram.rs:688 — NativeHistogram::quantile_with_info has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 8, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NativeHistogram::fraction_with_info (cognitive 39) src/common/query/src/native_histogram.rs:774 — NativeHistogram::fraction_with_info has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 13, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • NativeHistogram::detect_reset (cognitive 21) src/common/query/src/native_histogram.rs:555 — NativeHistogram::detect_reset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchGcProcedure · ×3
  • BatchGcProcedure::get_file_references (cognitive 38) src/meta-srv/src/gc/procedure.rs:648 — BatchGcProcedure::get_file_references has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 9 (15 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BatchGcProcedure::send_gc_instructions (cognitive 20) src/meta-srv/src/gc/procedure.rs:824 — BatchGcProcedure::send_gc_instructions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (4 pts), loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BatchGcProcedure::cleanup_region_repartition (cognitive 16) src/meta-srv/src/gc/procedure.rs:465 — BatchGcProcedure::cleanup_region_repartition has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchingEngine · ×3
  • BatchingEngine::handle_mark_dirty_time_window (cognitive 34) src/flow/src/batching_mode/engine.rs:185 — BatchingEngine::handle_mark_dirty_time_window has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 8 (17 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BatchingEngine::handle_inserts_inner (cognitive 22) src/flow/src/batching_mode/engine.rs:322 — BatchingEngine::handle_inserts_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BatchingEngine::create_flow_inner (cognitive 16) src/flow/src/batching_mode/engine.rs:558 — BatchingEngine::create_flow_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, match/switch 3, boolean chains 1, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · datatypes · ×3
  • datatypes::vectors::json::builder::count_dynamic_paths (cognitive 30) src/datatypes/src/vectors/json/builder.rs:492 — datatypes::vectors::json::builder::count_dynamic_paths has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 4, match/switch 1 (4 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datatypes::json::validate_type_hints (cognitive 21) src/datatypes/src/json.rs:218 — datatypes::json::validate_type_hints has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • datatypes::json::coerce_json_value_to_type (cognitive 17) src/datatypes/src/json.rs:518 — datatypes::json::coerce_json_value_to_type has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StatementExecutor · ×3
  • StatementExecutor::copy_table_from (cognitive 27) src/operator/src/statement/copy_table_from.rs:477 — StatementExecutor::copy_table_from has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StatementExecutor::determine_flow_type (cognitive 24) src/operator/src/statement/ddl.rs:980 — StatementExecutor::determine_flow_type has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 2, boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • StatementExecutor::repartition_table (cognitive 20) src/operator/src/statement/ddl.rs:1814 — StatementExecutor::repartition_table has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 5 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StartCommand · ×3
  • StartCommand::merge_with_cli_options (cognitive 22) src/cmd/src/frontend.rs:260 — StartCommand::merge_with_cli_options has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20 (22 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • StartCommand::merge_with_cli_options (cognitive 19) src/cmd/src/datanode.rs:302 — StartCommand::merge_with_cli_options has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • StartCommand::merge_with_cli_options (cognitive 16) src/cmd/src/metasrv.rs:226 — StartCommand::merge_with_cli_options has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · RegionServerInner · ×3
  • RegionServerInner::get_engine (cognitive 21) src/datanode/src/region_server.rs:1550 — RegionServerInner::get_engine has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 9 (21 pts) (nesting depth added 12). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • RegionServerInner::handle_batch_open_requests_inner (cognitive 21) src/datanode/src/region_server.rs:1625 — RegionServerInner::handle_batch_open_requests_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionServerInner::handle_read (cognitive 17) src/datanode/src/region_server.rs:2183 — RegionServerInner::handle_read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · common_meta · ×3
  • common_meta::ddl::alter_database::build_new_schema_value (cognitive 20) src/common/meta/src/ddl/alter_database.rs:51 — common_meta::ddl::alter_database::build_new_schema_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • common_meta::ddl::utils::handle_multiple_results (cognitive 16) src/common/meta/src/ddl/utils.rs:246 — common_meta::ddl::utils::handle_multiple_results has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • common_meta::kv_backend::util::skip_value (cognitive 16) src/common/meta/src/kv_backend/util.rs:175 — common_meta::kv_backend::util::skip_value has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (1 corresponding lines) · ×3
  • Edited copy of a member (1 corresponding lines) src/client/src/error.rs:233 — src/client/src/error.rs:233-233 | src/meta-client/src/error.rs:204-204 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) .github/scripts/agent-observability-summary.py:60 — .github/scripts/agent-observability-summary.py:60-60 | .github/scripts/tracesbench-summary.py:41-41 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (1 corresponding lines) .github/scripts/benchmark-version-comparison.py:50 — .github/scripts/benchmark-version-comparison.py:50-50 | .github/scripts/benchmark_resource_summary.py:21-21 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×3
  • Edited copy of a member (32 corresponding lines) src/common/runtime/src/runtime.rs:144 — src/common/runtime/src/runtime.rs:144-183 | src/common/runtime/src/runtime.rs:187-218 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) src/meta-srv/src/cluster.rs:71 — src/meta-srv/src/cluster.rs:71-102 | src/meta-srv/src/cluster.rs:120-151 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) tests-fuzz/src/utils/cluster_info.rs:48 — tests-fuzz/src/utils/cluster_info.rs:48-79 | tests-fuzz/src/utils/cluster_info.rs:81-118 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×3
  • Edited copy of a member (35 corresponding lines) src/servers/src/http/otlp.rs:294 — src/servers/src/http/otlp.rs:294-328 | src/servers/src/http/otlp.rs:347-383 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) src/common/meta/src/cache/container.rs:232 — src/common/meta/src/cache/container.rs:232-266 | src/common/meta/src/cache/container.rs:306-342 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) src/common/function/src/scalars/ip/range.rs:205 — src/common/function/src/scalars/ip/range.rs:205-239 | src/common/function/src/scalars/ip/range.rs:241-275 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×3
  • Edited copy of a member (39 corresponding lines) src/sql/src/parsers/alter_parser.rs:544 — src/sql/src/parsers/alter_parser.rs:544-590 | src/sql/src/parsers/alter_parser.rs:592-630 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) src/catalog/src/kvbackend/manager.rs:321 — src/catalog/src/kvbackend/manager.rs:321-372 | src/catalog/src/kvbackend/manager.rs:380-418 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) src/meta-srv/src/procedure/repartition/repartition_start.rs:239 — src/meta-srv/src/procedure/repartition/repartition_start.rs:239-287 | src/meta-srv/src/procedure/repartition/repartition_start.rs:292-330 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 28+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 28+ corresponding lines) src/promql/src/extension_plan/range_manipulate.rs:269 — src/promql/src/extension_plan/range_manipulate.rs:269-300 | src/promql/src/extension_plan/scalar_calculate.rs:235-262 | src/query/src/range_select/plan.rs:298-329 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 28+ corresponding lines) src/mito2/src/memtable/bulk.rs:631 — src/mito2/src/memtable/bulk.rs:631-668 | src/mito2/src/memtable/simple_bulk_memtable.rs:329-356 | src/mito2/src/memtable/time_series.rs:413-448 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 28+ corresponding lines) src/file-engine/src/engine.rs:280 — src/file-engine/src/engine.rs:280-314 | src/file-engine/src/engine.rs:320-347 | src/relational-engine/src/engine.rs:321-348 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 21+ corresponding lines) src/common/function/src/scalars/geo/h3.rs:648 — src/common/function/src/scalars/geo/h3.rs:648-675 | src/common/function/src/scalars/geo/h3.rs:761-781 | src/common/function/src/scalars/geo/h3.rs:827-850 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) src/common/function/src/scalars/geo/h3.rs:371 — src/common/function/src/scalars/geo/h3.rs:371-391 | src/common/function/src/scalars/geo/h3.rs:888-909 | src/common/function/src/scalars/geo/h3.rs:947-968 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) src/promql/src/extension_plan/instant_manipulate.rs:149 — src/promql/src/extension_plan/instant_manipulate.rs:149-169 | src/promql/src/extension_plan/normalize.rs:101-122 | src/promql/src/extension_plan/series_divide.rs:194-215 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 17+ corresponding lines) src/promql/src/extension_plan/instant_manipulate.rs:648 — src/promql/src/extension_plan/instant_manipulate.rs:648-666 | src/promql/src/extension_plan/normalize.rs:494-510 | src/promql/src/extension_plan/range_manipulate.rs:654-677 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) src/datanode/src/region_server/catalog.rs:118 — src/datanode/src/region_server/catalog.rs:118-137 | src/datanode/src/region_server/catalog.rs:140-156 | src/datanode/src/region_server/catalog.rs:159-175 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) src/common/function/src/aggrs/vector/avg.rs:64 — src/common/function/src/aggrs/vector/avg.rs:64-80 | src/common/function/src/aggrs/vector/product.rs:63-79 | src/common/function/src/aggrs/vector/sum.rs:63-79 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 25+ corresponding lines) src/meta-srv/src/procedure/drain_datanode.rs:299 — src/meta-srv/src/procedure/drain_datanode.rs:299-323 | src/meta-srv/src/procedure/repartition.rs:761-788 | src/meta-srv/src/procedure/repartition/group.rs:215-245 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 25+ corresponding lines) src/mito2/src/sst/index/bloom_filter/applier.rs:69 — src/mito2/src/sst/index/bloom_filter/applier.rs:69-93 | src/mito2/src/sst/index/fulltext_index/applier.rs:77-113 | src/mito2/src/sst/index/inverted_index/applier.rs:68-96 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 25+ corresponding lines) src/mito2/src/read/seq_scan.rs:379 — src/mito2/src/read/seq_scan.rs:379-403 | src/mito2/src/read/series_scan.rs:205-229 | src/mito2/src/read/unordered_scan.rs:221-246 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 19+ corresponding lines) src/meta-client/src/client/procedure.rs:267 — src/meta-client/src/client/procedure.rs:267-295 | src/meta-client/src/client/procedure.rs:297-316 | src/meta-client/src/client/procedure.rs:406-429 | src/meta-client/src/client/procedure.rs:458-476 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 19+ corresponding lines) src/common/meta/src/key/table_info.rs:62 — src/common/meta/src/key/table_info.rs:62-80 | src/common/meta/src/key/table_repart.rs:66-84 | src/common/meta/src/key/table_route.rs:325-343 | src/common/meta/src/key/view_info.rs:61-80 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 19+ corresponding lines) src/promql/src/extension_plan/instant_manipulate.rs:387 — src/promql/src/extension_plan/instant_manipulate.rs:387-406 | src/promql/src/extension_plan/normalize.rs:228-246 | src/promql/src/extension_plan/range_manipulate.rs:214-233 | src/promql/src/extension_plan/scalar_calculate.rs:170-191 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×3
  • Edited copy of a member (3 corresponding lines) .github/scripts/agent-observability-summary.py:70 — .github/scripts/agent-observability-summary.py:70-72 | .github/scripts/tracesbench-summary.py:51-53 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) .github/scripts/agent-observability-summary.py:76 — .github/scripts/agent-observability-summary.py:76-78 | .github/scripts/tracesbench-summary.py:57-59 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) .github/scripts/oswal-s3-bench.py:108 — .github/scripts/oswal-s3-bench.py:108-110 | .github/scripts/runner_utils.py:84-87 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×3
  • Duplicated block (30 lines × 2) src/common/meta/src/key/flow.rs:262 — src/common/meta/src/key/flow.rs:262-291 | src/common/meta/src/key/flow.rs:358-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/flow.rs:262` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (30 lines × 2) src/table/src/metadata.rs:591 — src/table/src/metadata.rs:591-620 | src/table/src/metadata.rs:651-680 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/table/src/metadata.rs:591` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `requests` to `&[SetIndexOption]` in one and `&[UnsetIndexOption]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (30 lines × 2) tests-fuzz/targets/fuzz_insert.rs:166 — tests-fuzz/targets/fuzz_insert.rs:166-195 | tests-fuzz/targets/fuzz_insert_logical_table.rs:160-189 — before extracting anything, compare `tests-fuzz/targets/fuzz_insert.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/fuzz_insert.rs:166` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • Duplicated block (25 lines × 2) src/common/function/src/aggrs/geo/encoding.rs:221 — src/common/function/src/aggrs/geo/encoding.rs:221-245 | src/common/function/src/aggrs/geo/geo_path.rs:250-274 — before extracting anything, compare `src/common/function/src/aggrs/geo/encoding.rs` and `src/common/function/src/aggrs/geo/geo_path.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/geo/encoding.rs:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (25 lines × 2) src/flow/src/adapter.rs:588 — src/flow/src/adapter.rs:588-612 | src/flow/src/adapter.rs:617-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/adapter.rs:588` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (25 lines × 2) src/servers/src/http/prometheus.rs:492 — src/servers/src/http/prometheus.rs:492-516 | src/servers/src/http/prometheus.rs:629-653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http/prometheus.rs:492` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) src/cmd/src/bin/query_regression_runner/otlp.rs:330 — src/cmd/src/bin/query_regression_runner/otlp.rs:330-351 | src/cmd/src/bin/query_regression_runner/remote/ingest.rs:427-448 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/bin/query_regression_runner/otlp.rs:330` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22 lines × 2) src/cmd/src/flownode.rs:187 — src/cmd/src/flownode.rs:187-208 | src/cmd/src/frontend.rs:265-286 — before extracting anything, compare `src/cmd/src/flownode.rs` and `src/cmd/src/frontend.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `opts` to `&mut FlownodeOptions` in one and `&mut FrontendOptions` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (22 lines × 2) src/mito2/src/read/seq_scan.rs:558 — src/mito2/src/read/seq_scan.rs:558-579 | src/mito2/src/read/series_scan.rs:491-512 — before extracting anything, compare `src/mito2/src/read/seq_scan.rs` and `src/mito2/src/read/series_scan.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/seq_scan.rs:558` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×3
  • Duplicated block (20 lines × 2) src/frontend/src/instance/otlp/trace_ingest.rs:1465 — src/frontend/src/instance/otlp/trace_ingest.rs:1465-1484 | src/frontend/src/instance/otlp/trace_ingest.rs:1635-1654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/otlp/trace_ingest.rs:1465` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (20 lines × 2) src/mito2/src/manifest/manager.rs:557 — src/mito2/src/manifest/manager.rs:557-576 | src/mito2/src/manifest/manager.rs:821-840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/manifest/manager.rs:557` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20 lines × 2) src/pipeline/src/etl/processor/json_path.rs:136 — src/pipeline/src/etl/processor/json_path.rs:136-155 | src/pipeline/src/etl/processor/simple_extract.rs:107-126 — before extracting anything, compare `src/pipeline/src/etl/processor/json_path.rs` and `src/pipeline/src/etl/processor/simple_extract.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/json_path.rs:136` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×3
  • Duplicated block (13–15 lines × 2) src/mito2/src/manifest/manager.rs:372 — src/mito2/src/manifest/manager.rs:372-384 | src/mito2/src/manifest/manager.rs:550-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/manifest/manager.rs:372` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–15 lines × 2) src/promql/src/extension_plan/instant_manipulate.rs:488 — src/promql/src/extension_plan/instant_manipulate.rs:488-502 | src/promql/src/extension_plan/range_manipulate.rs:497-509 — before extracting anything, compare `src/promql/src/extension_plan/instant_manipulate.rs` and `src/promql/src/extension_plan/range_manipulate.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/extension_plan/instant_manipulate.rs:488` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–15 lines × 2) src/servers/src/elasticsearch.rs:211 — src/servers/src/elasticsearch.rs:211-225 | src/servers/src/elasticsearch.rs:238-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) src/common/function/src/admin/flush_compact_table.rs:172 — src/common/function/src/admin/flush_compact_table.rs:172-180 | src/common/function/src/admin/reconcile_table.rs:64-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/admin/flush_compact_table.rs:172` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8–9 lines × 2) src/common/function/src/scalars/hll_count.rs:81 — src/common/function/src/scalars/hll_count.rs:81-89 | src/common/function/src/scalars/welford_stddev.rs:75-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–9 lines × 2) src/mito2/src/compaction/compactor.rs:226 — src/mito2/src/compaction/compactor.rs:226-233 | src/mito2/src/worker.rs:199-207 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×3
  • Duplicated block (5 lines × 3) src/common/meta/src/ddl/create_table.rs:395 — src/common/meta/src/ddl/create_table.rs:395-399 | src/common/meta/src/ddl/create_view.rs:268-272 | src/common/meta/src/reconciliation/reconcile_table.rs:357-361 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/create_table.rs:395` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) src/common/meta/src/key/flow/flow_route.rs:56 — src/common/meta/src/key/flow/flow_route.rs:56-60 | src/common/meta/src/key/flow/flownode_flow.rs:70-74 | src/common/meta/src/key/flow/table_flow.rs:88-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/common/meta/src/key/flow/table_flow.rs:95` calls `source_table_id` and `src/common/meta/src/key/flow/flow_route.rs:63` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) src/meta-srv/src/key.rs:60 — src/meta-srv/src/key.rs:60-64 | src/meta-srv/src/key.rs:101-105 | src/meta-srv/src/key/datanode.rs:110-114 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×3
  • Duplicated block (9 lines × 4) src/common/meta/src/reconciliation/reconcile_catalog.rs:57 — src/common/meta/src/reconciliation/reconcile_catalog.rs:57-65 | src/common/meta/src/reconciliation/reconcile_database.rs:64-72 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:62-70 | src/common/meta/src/reconciliation/reconcile_table.rs:163-171 — before extracting anything, compare `src/common/meta/src/reconciliation/reconcile_catalog.rs` and `src/common/meta/src/reconciliation/reconcile_database.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 4) src/common/function/src/admin/flush_compact_table.rs:61 — src/common/function/src/admin/flush_compact_table.rs:61-69 | src/common/function/src/admin/gc.rs:137-145 | src/common/function/src/admin/purge_table.rs:48-58 | src/common/function/src/flush_flow.rs:66-74 — before extracting anything, compare `src/common/function/src/admin/flush_compact_table.rs` and `src/common/function/src/admin/purge_table.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/admin/flush_compact_table.rs:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:165 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:165-174 | tests-fuzz/targets/fuzz_insert.rs:140-149 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:164-173 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:286-294 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 230 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
AXI1 · Runtime container hardening · Container process runs as root · ×2
  • Container process runs as root: fixtures-postgres-1 — 'fixtures-postgres-1' (docker.io/postgres:14-alpine) runs as uid 0 — no user was specified, or one resolving to root was. Observed on the running container, which is the only place the answer is settled: an image's own USER, a base image's inherited one and a compose override are all invisible to a REDACTED reader. Advisory evidence for CRA Annex I (2)(b).
  • Container process runs as root: fixtures-postgres15-1 — 'fixtures-postgres15-1' (docker.io/postgres:15-alpine) runs as uid 0 — no user was specified, or one resolving to root was. Observed on the running container, which is the only place the answer is settled: an image's own USER, a base image's inherited one and a compose override are all invisible to a REDACTED reader. Advisory evidence for CRA Annex I (2)(b).
D1 · Cyclomatic Complexity · frontend · ×2
  • frontend::instance::check_permission (cyclomatic 48) src/frontend/src/instance.rs:1619 — frontend::instance::check_permission has cyclomatic complexity 48 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • frontend::instance::grpc::fill_catalog_and_schema_from_context (cyclomatic 28) src/frontend/src/instance/grpc.rs:326 — frontend::instance::grpc::fill_catalog_and_schema_from_context has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConcreteDataType · ×2
  • ConcreteDataType::from (cyclomatic 41) src/api/src/helper.rs:113 — ConcreteDataType::from has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • ConcreteDataType::fmt (cyclomatic 36) src/datatypes/src/data_type.rs:93 — ConcreteDataType::fmt has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MitoRegion · ×2
  • MitoRegion::set_role_state_gracefully (cyclomatic 25) src/mito2/src/region.rs:598 — MitoRegion::set_role_state_gracefully has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • MitoRegion::manifest_sst_stream (cyclomatic 17) src/mito2/src/region.rs:961 — MitoRegion::manifest_sst_stream has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistogramFoldStream · ×2
  • HistogramFoldStream::evaluate_row (cyclomatic 25) src/promql/src/extension_plan/histogram_fold.rs:1240 — HistogramFoldStream::evaluate_row has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • HistogramFoldStream::evaluate_fraction (cyclomatic 24) src/promql/src/extension_plan/histogram_fold.rs:1359 — HistogramFoldStream::evaluate_fraction has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Predicate · ×2
  • Predicate::eval (cyclomatic 24) src/catalog/src/system_schema/predicate.rs:43 — Predicate::eval has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • Predicate::from_expr (cyclomatic 20) src/catalog/src/system_schema/predicate.rs:120 — Predicate::from_expr has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · common_function · ×2
  • common_function::scalars::math::clamp::clamp_impl (cyclomatic 23) src/common/function/src/scalars/math/clamp.rs:75 — common_function::scalars::math::clamp::clamp_impl has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • common_function::admin::flush_compact_table::parse_compact_options (cyclomatic 16) src/common/function/src/admin/flush_compact_table.rs:194 — common_function::admin::flush_compact_table::parse_compact_options has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · cli · ×2
  • cli::data::import_v2::packed::validate_snapshot (cyclomatic 22) REDACTED:28 — cli::data::import_v2::packed::validate_snapshot has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • cli::data::import_v2::command::iter_ddl_statements (cyclomatic 19) src/cli/src/data/import_v2/command.rs:426 — cli::data::import_v2::command::iter_ddl_statements has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · query · ×2
  • query::promql::planner::matching_filters::try_propagate (cyclomatic 22) src/query/src/promql/planner/matching_filters.rs:96 — query::promql::planner::matching_filters::try_propagate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
  • query::range_select::plan_rewrite::evaluate_expr_to_millisecond (cyclomatic 16) src/query/src/range_select/plan_rewrite.rs:157 — query::range_select::plan_rewrite::evaluate_expr_to_millisecond has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · PreparedMetrics · ×2
  • PreparedMetrics::finish (cyclomatic 22) src/servers/src/otlp/metrics/prepare.rs:407 — PreparedMetrics::finish has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • PreparedMetrics::push_point (cyclomatic 17) src/servers/src/otlp/metrics/prepare.rs:199 — PreparedMetrics::push_point has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · common_sql · ×2
  • common_sql::convert::sql_value_to_value (cyclomatic 19) src/common/sql/src/convert.rs:127 — common_sql::convert::sql_value_to_value has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
  • common_sql::convert::parse_string_to_value (cyclomatic 16) src/common/sql/src/convert.rs:261 — common_sql::convert::parse_string_to_value has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D2 · Cognitive Complexity · MergeScanExec · ×2
  • MergeScanExec::to_stream (cognitive 57) src/query/src/dist_plan/merge_scan.rs:617 — MergeScanExec::to_stream has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (49 pts), match/switch 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MergeScanExec::fmt_as (cognitive 20) src/query/src/dist_plan/merge_scan.rs:1202 — MergeScanExec::fmt_as has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (8 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoundedStager · ×2
  • BoundedStager::delete_routine (cognitive 41) src/puffin/src/puffin_manager/stager/bounded_stager.rs:475 — BoundedStager::delete_routine has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (35 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • BoundedStager::recover (cognitive 18) src/puffin/src/puffin_manager/stager/bounded_stager.rs:372 — BoundedStager::recover has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WriteDispatcher · ×2
  • WriteDispatcher::execute_tracked (cognitive 40) src/operator/src/write_dispatcher/progress.rs:117 — WriteDispatcher::execute_tracked has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 3 (9 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • WriteDispatcher::send_batch (cognitive 23) src/operator/src/write_dispatcher.rs:327 — WriteDispatcher::send_batch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PreparedMetrics · ×2
  • PreparedMetrics::finish (cognitive 40) src/servers/src/otlp/metrics/prepare.rs:407 — PreparedMetrics::finish has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 7 (12 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PreparedMetrics::push_point (cognitive 26) src/servers/src/otlp/metrics/prepare.rs:199 — PreparedMetrics::push_point has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (8 pts), boolean chains 5, match/switch 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PostgresServerHandlerInner · ×2
  • PostgresServerHandlerInner::on_startup (cognitive 39) src/servers/src/postgres/auth_handler.rs:279 — PostgresServerHandlerInner::on_startup has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (27 pts), match/switch 5 (11 pts), boolean chains 1 (nesting depth added 23). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • PostgresServerHandlerInner::do_query (cognitive 16) src/servers/src/postgres/handler.rs:76 — PostgresServerHandlerInner::do_query has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · RangeSelectStream · ×2
  • RangeSelectStream::generate_output (cognitive 36) src/query/src/range_select/plan.rs:1095 — RangeSelectStream::generate_output has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 7 (15 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RangeSelectStream::poll_next (cognitive 17) src/query/src/range_select/plan.rs:1242 — RangeSelectStream::poll_next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (8 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · common_recordbatch · ×2
  • common_recordbatch::adapter::convert_map_to_json_binary (cognitive 35) src/common/recordbatch/src/adapter.rs:831 — common_recordbatch::adapter::convert_map_to_json_binary has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 4 (15 pts), loops 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • common_recordbatch::map_json_type_to_string (cognitive 17) src/common/recordbatch/src/lib.rs:100 — common_recordbatch::map_json_type_to_string has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · frontend · ×2
  • frontend::instance::grpc::fill_catalog_and_schema_from_context (cognitive 35) src/frontend/src/instance/grpc.rs:326 — frontend::instance::grpc::fill_catalog_and_schema_from_context has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (34 pts), match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • frontend::instance::exemplar::collect (cognitive 27) src/frontend/src/instance/exemplar.rs:313 — frontend::instance::exemplar::collect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MitoRegion · ×2
  • MitoRegion::manifest_sst_stream (cognitive 35) src/mito2/src/region.rs:961 — MitoRegion::manifest_sst_stream has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (27 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • MitoRegion::set_role_state_gracefully (cognitive 21) src/mito2/src/region.rs:598 — MitoRegion::set_role_state_gracefully has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 5 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · InvertedIndexer · ×2
  • InvertedIndexer::do_update_flat (cognitive 35) src/mito2/src/sst/index/inverted_index/creator.rs:176 — InvertedIndexer::do_update_flat has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • InvertedIndexer::do_update (cognitive 18) src/mito2/src/sst/index/inverted_index/creator.rs:314 — InvertedIndexer::do_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PartitionChecker · ×2
  • PartitionChecker::remap_checkpoint (cognitive 35) REDACTED:167 — PartitionChecker::remap_checkpoint has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 2, loops 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • PartitionChecker::run (cognitive 27) REDACTED:62 — PartitionChecker::run has cognitive complexity 27 (threshold 15). Drivers by points: loops 8 (14 pts), if/else 6 (13 pts) (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Predicate · ×2
  • Predicate::eval (cognitive 34) src/catalog/src/system_schema/predicate.rs:43 — Predicate::eval has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (8 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • Predicate::from_expr (cognitive 34) src/catalog/src/system_schema/predicate.rs:120 — Predicate::from_expr has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 3 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 19). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · sql · ×2
  • sql::statements::insert::sql_exprs_to_values (cognitive 33) src/sql/src/statements/insert.rs:150 — sql::statements::insert::sql_exprs_to_values has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (22 pts), match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • sql::parsers::create_parser::json::parse_json2_type_hint (cognitive 18) src/sql/src/parsers/create_parser/json.rs:140 — sql::parsers::create_parser::json::parse_json2_type_hint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SeriesDivideStream · ×2
  • SeriesDivideStream::poll_next (cognitive 32) src/promql/src/extension_plan/series_divide.rs:585 — SeriesDivideStream::poll_next has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
  • SeriesDivideStream::find_first_diff_row (cognitive 17) src/promql/src/extension_plan/series_divide.rs:668 — SeriesDivideStream::find_first_diff_row has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HeartbeatTask · ×2
  • HeartbeatTask::start (cognitive 31) src/datanode/src/heartbeat.rs:240 — HeartbeatTask::start has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 3 (10 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • HeartbeatTask::create_streams (cognitive 17) src/datanode/src/heartbeat.rs:148 — HeartbeatTask::create_streams has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (4 pts), match/switch 1 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Pattern · ×2
  • Pattern::from_str (cognitive 30) src/pipeline/src/etl/processor/dissect.rs:206 — Pattern::from_str has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Pattern::check (cognitive 21) src/pipeline/src/etl/processor/dissect.rs:328 — Pattern::check has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TableMeta · ×2
  • TableMeta::set_table_options (cognitive 30) src/table/src/metadata.rs:358 — TableMeta::set_table_options has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (27 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TableMeta::add_columns (cognitive 19) src/table/src/metadata.rs:785 — TableMeta::add_columns has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RangePlanRewriter · ×2
  • RangePlanRewriter::get_index_by (cognitive 25) src/query/src/range_select/plan_rewrite.rs:559 — RangePlanRewriter::get_index_by has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RangePlanRewriter::rewrite_logical_plan (cognitive 22) src/query/src/range_select/plan_rewrite.rs:410 — RangePlanRewriter::rewrite_logical_plan has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExportCreate · ×2
  • ExportCreate::run (cognitive 23) src/cli/src/data/export_v2/command.rs:485 — ExportCreate::run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ExportCreate::get_schema_objects (cognitive 17) src/cli/src/data/export_v2/command.rs:655 — ExportCreate::get_schema_objects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (6 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RepairPartitionColumnTool · ×2
  • RepairPartitionColumnTool::do_work (cognitive 23) src/cli/src/metadata/repair/partition_column.rs:194 — RepairPartitionColumnTool::do_work has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (20 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RepairPartitionColumnTool::do_repair (cognitive 20) src/cli/src/metadata/repair/partition_column.rs:68 — RepairPartitionColumnTool::do_repair has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · common_config · ×2
  • common_config::file_watcher::resolve_one (cognitive 23) src/common/config/src/file_watcher.rs:268 — common_config::file_watcher::resolve_one has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (5 pts), match/switch 2 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • common_config::tagged_seq::merge_at (cognitive 17) src/common/config/src/tagged_seq.rs:288 — common_config::tagged_seq::merge_at has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · PlanRewriter · ×2
  • PlanRewriter::should_expand (cognitive 23) src/query/src/dist_plan/analyzer.rs:495 — PlanRewriter::should_expand has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • PlanRewriter::maybe_set_partitions (cognitive 18) src/query/src/dist_plan/analyzer.rs:664 — PlanRewriter::maybe_set_partitions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flow · ×2
  • flow::batching_mode::table_creator::create_table_with_expr (cognitive 22) src/flow/src/batching_mode/table_creator.rs:39 — flow::batching_mode::table_creator::create_table_with_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • flow::batching_mode::time_window::find_time_window_expr (cognitive 22) src/flow/src/batching_mode/time_window.rs:431 — flow::batching_mode::time_window::find_time_window_expr has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionSupervisor · ×2
  • RegionSupervisor::handle_region_failures (cognitive 22) src/meta-srv/src/region/supervisor.rs:582 — RegionSupervisor::handle_region_failures has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 5 (9 pts), match/switch 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • RegionSupervisor::select_peers (cognitive 18) src/meta-srv/src/region/supervisor.rs:676 — RegionSupervisor::select_peers has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (8 pts), if/else 4 (6 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · meta_srv · ×2
  • meta_srv::procedure::repartition::allocate_region::collect_allocation_sources (cognitive 21) src/meta-srv/src/procedure/repartition/allocate_region.rs:466 — meta_srv::procedure::repartition::allocate_region::collect_allocation_sources has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (10 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • meta_srv::procedure::utils::handle_flush_region_reply (cognitive 17) src/meta-srv/src/procedure/utils.rs:75 — meta_srv::procedure::utils::handle_flush_region_reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CompactionScheduler · ×2
  • CompactionScheduler::handle_compaction_pick_finished_inner (cognitive 21) src/mito2/src/compaction/scheduler/planning.rs:357 — CompactionScheduler::handle_compaction_pick_finished_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • CompactionScheduler::prepare_or_submit_compaction (cognitive 21) src/mito2/src/compaction/scheduler/planning.rs:523 — CompactionScheduler::prepare_or_submit_compaction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanRegion · ×2
  • ScanRegion::build_read_col_ids (cognitive 21) src/mito2/src/read/scan_region.rs:636 — ScanRegion::build_read_col_ids has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • ScanRegion::scan_input (cognitive 16) src/mito2/src/read/scan_region.rs:473 — ScanRegion::scan_input has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TombstoneManager · ×2
  • TombstoneManager::move_values_inner (cognitive 20) src/common/meta/src/key/tombstone.rs:210 — TombstoneManager::move_values_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TombstoneManager::move_values_with_extra (cognitive 20) src/common/meta/src/key/tombstone.rs:323 — TombstoneManager::move_values_with_extra has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Indexer · ×2
  • Indexer::enforce_memory_limits (cognitive 20) src/mito2/src/sst/index.rs:414 — Indexer::enforce_memory_limits has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Indexer::do_update (cognitive 16) src/mito2/src/sst/index/indexer/update.rs:24 — Indexer::do_update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · common_sql · ×2
  • common_sql::convert::parse_string_to_value (cognitive 19) src/common/sql/src/convert.rs:261 — common_sql::convert::parse_string_to_value has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • common_sql::convert::sql_value_to_value (cognitive 16) src/common/sql/src/convert.rs:127 — common_sql::convert::sql_value_to_value has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (11 pts), if/else 3, boolean chains 2 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · log_store · ×2
  • log_store::kafka::util::record::maybe_emit_entry (cognitive 19) src/log-store/src/kafka/util/record.rs:256 — log_store::kafka::util::record::maybe_emit_entry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • log_store::object_store_wal::prefetch::segments (cognitive 19) src/log-store/src/object_store_wal/prefetch.rs:108 — log_store::object_store_wal::prefetch::segments has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (4 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnMatcherRewriter · ×2
  • ColumnMatcherRewriter::modify_project_exprs (cognitive 17) src/flow/src/batching_mode/utils.rs:1395 — ColumnMatcherRewriter::modify_project_exprs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
  • ColumnMatcherRewriter::modify_project_exprs_with_partial (cognitive 16) src/flow/src/batching_mode/utils.rs:1578 — ColumnMatcherRewriter::modify_project_exprs_with_partial has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Inner · ×2
  • Inner::with_retry (cognitive 17) src/meta-client/src/client/cluster.rs:168 — Inner::with_retry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Inner::with_retry (cognitive 17) src/meta-client/src/client/procedure.rs:202 — Inner::with_retry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TwcsPicker · ×2
  • TwcsPicker::build_candidates (cognitive 17) src/mito2/src/compaction/twcs.rs:258 — TwcsPicker::build_candidates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TwcsPicker::pick_window (cognitive 16) src/mito2/src/compaction/twcs.rs:386 — TwcsPicker::pick_window has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (8 members, 50+ identical tokens) src/common/meta/src/key.rs:765 — src/common/meta/src/key.rs:765-826 | src/common/meta/src/key.rs:835-908 | src/common/meta/src/key.rs:1495-1547 | src/common/meta/src/key.rs:1557-1592 | src/common/meta/src/key.rs:1614-1643 | src/common/meta/src/key.rs:1712-1761 | src/common/meta/src/key.rs:1772-1813 | src/common/meta/src/key/schema_name.rs:301-320 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
  • Members sharing a duplicated core (8 members, 50+ identical tokens) src/table/src/metadata.rs:566 — src/table/src/metadata.rs:566-620 | src/table/src/metadata.rs:626-680 | src/table/src/metadata.rs:789-939 | src/table/src/metadata.rs:945-1035 | src/table/src/metadata.rs:1041-1213 | src/table/src/metadata.rs:1219-1284 | src/table/src/metadata.rs:1338-1389 | src/table/src/metadata.rs:1395-1432 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 30+ corresponding lines) src/common/meta/src/ddl/alter_table/partition_compat.rs:236 — src/common/meta/src/ddl/alter_table/partition_compat.rs:236-265 | src/datatypes/src/value.rs:445-512 | src/partition/src/expr.rs:73-118 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 30+ corresponding lines) src/servers/src/http.rs:1197 — src/servers/src/http.rs:1197-1238 | src/servers/src/http.rs:1331-1360 | src/servers/src/http.rs:1362-1395 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×2
  • Edited copy of a member (42 corresponding lines) src/datatypes/src/vectors/json/variant.rs:74 — src/datatypes/src/vectors/json/variant.rs:74-115 | src/datatypes/src/vectors/json/variant.rs:120-161 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (42 corresponding lines) src/mito2/src/engine.rs:949 — src/mito2/src/engine.rs:949-990 | src/mito2/src/engine.rs:1046-1087 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×2
  • Edited copy of a member (48 corresponding lines) src/servers/src/batcher/logical_table/tables.rs:261 — src/servers/src/batcher/logical_table/tables.rs:261-317 | src/servers/src/batcher/logical_table/tables.rs:369-416 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) src/servers/src/http/otlp.rs:166 — src/servers/src/http/otlp.rs:166-221 | src/servers/src/http/otlp.rs:233-280 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×2
  • Edited copy of a member (36 corresponding lines) src/datanode/src/heartbeat/handler/file_ref.rs:34 — src/datanode/src/heartbeat/handler/file_ref.rs:34-69 | src/datanode/src/heartbeat/handler/file_ref.rs:82-120 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) tests-integration/src/test_util.rs:1092 — tests-integration/src/test_util.rs:1092-1137 | tests-integration/src/test_util.rs:1162-1197 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 24+ corresponding lines) src/mito2/src/read/scan_region.rs:803 — src/mito2/src/read/scan_region.rs:803-836 | src/mito2/src/read/scan_region.rs:839-863 | src/mito2/src/read/scan_region.rs:866-889 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) src/promql/src/extension_plan/instant_manipulate.rs:487 — src/promql/src/extension_plan/instant_manipulate.rs:487-513 | src/promql/src/extension_plan/range_manipulate.rs:189-212 | src/promql/src/extension_plan/range_manipulate.rs:496-520 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×2
  • Edited copy of a member (40 corresponding lines) src/promql/src/extension_plan/normalize.rs:136 — src/promql/src/extension_plan/normalize.rs:136-179 | src/promql/src/extension_plan/series_divide.rs:225-264 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (40 corresponding lines) tests-integration/src/test_util.rs:1210 — tests-integration/src/test_util.rs:1210-1254 | tests-integration/src/test_util.rs:1272-1311 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 1+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 1+ corresponding lines) src/datanode/src/error.rs:627 — src/datanode/src/error.rs:627-627 | src/flow/src/error.rs:381-381 | src/frontend/src/error.rs:517-517 | src/meta-srv/src/error.rs:1200-1200 | src/operator/src/error.rs:1214-1214 | src/servers/src/error.rs:924-924 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 1+ corresponding lines) tests-fuzz/src/fake.rs:54 — tests-fuzz/src/fake.rs:54-54 | tests-fuzz/src/ir.rs:87-87 | tests-fuzz/src/ir.rs:88-88 | tests-fuzz/src/ir.rs:89-89 | tests-fuzz/src/ir.rs:94-94 | tests-fuzz/src/ir.rs:99-99 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 20+ corresponding lines) src/common/function/src/scalars/geo/h3.rs:1001 — src/common/function/src/scalars/geo/h3.rs:1001-1032 | src/common/function/src/scalars/geo/h3.rs:1212-1237 | src/common/function/src/scalars/geo/h3.rs:1278-1304 | src/common/function/src/scalars/geo/s2.rs:247-266 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 20+ corresponding lines) src/cli/src/data/snapshot_storage.rs:389 — src/cli/src/data/snapshot_storage.rs:389-408 | src/cli/src/data/snapshot_storage.rs:418-437 | src/cli/src/data/snapshot_storage.rs:447-471 | src/cli/src/data/snapshot_storage.rs:502-521 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 26+ corresponding lines) src/mito2/src/sst/index/bloom_filter/applier.rs:360 — src/mito2/src/sst/index/bloom_filter/applier.rs:360-390 | src/mito2/src/sst/index/fulltext_index/applier.rs:779-804 | src/mito2/src/sst/index/inverted_index/applier.rs:313-342 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 26+ corresponding lines) src/servers/src/otlp/trace/v0.rs:171 — src/servers/src/otlp/trace/v0.rs:171-196 | src/servers/src/otlp/trace/v0.rs:201-228 | src/servers/src/otlp/trace/v1.rs:502-529 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 10+ corresponding lines) src/common/time/src/time.rs:81 — src/common/time/src/time.rs:81-90 | src/common/time/src/timestamp.rs:267-276 | src/common/time/src/timestamp.rs:282-291 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) src/cli/src/data/export_v2/command.rs:88 — src/cli/src/data/export_v2/command.rs:88-97 | src/cli/src/data/export_v2/command.rs:142-151 | src/cli/src/data/export_v2/command.rs:201-211 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 15+ corresponding lines) src/pipeline/src/manager/pipeline_operator.rs:199 — src/pipeline/src/manager/pipeline_operator.rs:199-214 | src/pipeline/src/manager/pipeline_operator.rs:222-238 | src/pipeline/src/manager/pipeline_operator.rs:247-261 | src/pipeline/src/manager/pipeline_operator.rs:269-284 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 15+ corresponding lines) src/object-store/src/factory.rs:115 — src/object-store/src/factory.rs:115-129 | src/object-store/src/factory.rs:131-145 | src/object-store/src/factory.rs:147-161 | src/object-store/src/factory.rs:163-177 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 12+ corresponding lines) src/common/function/src/scalars/vector/elem_avg.rs:68 — src/common/function/src/scalars/vector/elem_avg.rs:68-80 | src/common/function/src/scalars/vector/elem_product.rs:81-93 | src/common/function/src/scalars/vector/elem_sum.rs:68-80 | src/common/function/src/scalars/vector/vector_dim.rs:81-92 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) src/meta-srv/src/procedure/region_migration.rs:638 — src/meta-srv/src/procedure/region_migration.rs:638-651 | src/meta-srv/src/procedure/region_migration.rs:655-668 | src/meta-srv/src/procedure/region_migration.rs:674-685 | src/meta-srv/src/procedure/region_migration.rs:691-702 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 15+ corresponding lines) src/common/meta/src/key/flow/flow_route.rs:180 — src/common/meta/src/key/flow/flow_route.rs:180-194 | src/common/meta/src/key/flow/table_flow.rs:203-217 | src/common/meta/src/key/table_repart.rs:162-178 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 15+ corresponding lines) src/meta-srv/src/procedure/repartition.rs:313 — src/meta-srv/src/procedure/repartition.rs:313-328 | src/meta-srv/src/procedure/repartition.rs:339-353 | src/meta-srv/src/procedure/repartition/group.rs:430-449 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 8+ corresponding lines) src/common/meta/src/key/flow/flow_info.rs:379 — src/common/meta/src/key/flow/flow_info.rs:379-386 | src/common/meta/src/key/flow/flow_name.rs:192-200 | src/common/meta/src/key/schema_name.rs:257-264 | src/common/meta/src/key/table_name.rs:241-248 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 8+ corresponding lines) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:69 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:69-77 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:213-221 | tests-fuzz/targets/ddl/fuzz_create_table.rs:59-66 | tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs:70-77 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) src/operator/src/expr_helper.rs:325 — src/operator/src/expr_helper.rs:325-352 | src/query/src/sql/show_create_table.rs:118-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (28 lines × 2) src/operator/src/req_convert/common.rs:375 — src/operator/src/req_convert/common.rs:375-402 | src/operator/src/req_convert/insert.rs:39-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×2
  • Duplicated block (22–23 lines × 2) src/pipeline/src/etl/processor/cmcd.rs:265 — src/pipeline/src/etl/processor/cmcd.rs:265-287 | src/pipeline/src/etl/processor/csv.rs:205-226 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/cmcd.rs:265` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (22–23 lines × 2) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:191 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:191-212 | tests-fuzz/targets/fuzz_insert_logical_table.rs:237-259 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:191` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tests-fuzz/targets/fuzz_insert_logical_table.rs:260` calls `validate_values`, `clone`, `insert` and `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:213` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×2
  • Duplicated block (23 lines × 2) src/servers/src/postgres/types.rs:1266 — src/servers/src/postgres/types.rs:1266-1288 | src/servers/src/postgres/types.rs:1369-1391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:1266` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (23 lines × 2) src/servers/src/http/prometheus.rs:868 — src/servers/src/http/prometheus.rs:868-890 | src/servers/src/http/prometheus.rs:1961-1983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/http/prometheus.rs:868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×2
  • Duplicated block (20–21 lines × 2) src/mito2/src/flush.rs:1618 — src/mito2/src/flush.rs:1618-1637 | src/mito2/src/flush.rs:1658-1678 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/flush.rs:1618` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (20–21 lines × 2) src/puffin/src/puffin_manager/stager/bounded_stager.rs:151 — src/puffin/src/puffin_manager/stager/bounded_stager.rs:151-170 | src/puffin/src/puffin_manager/stager/bounded_stager.rs:207-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/puffin/src/puffin_manager/stager/bounded_stager.rs:151` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) src/common/function/src/scalars/anomaly/mad.rs:101 — src/common/function/src/scalars/anomaly/mad.rs:101-120 | src/common/function/src/scalars/anomaly/zscore.rs:93-111 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/anomaly/mad.rs:101` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) src/partition/src/utils/split.rs:274 — src/partition/src/utils/split.rs:274-293 | src/partition/src/utils/split.rs:314-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/partition/src/utils/split.rs:274` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) src/log-store/src/raft_engine/log_store.rs:475 — src/log-store/src/raft_engine/log_store.rs:475-491 | src/log-store/src/raft_engine/log_store.rs:509-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (16–17 lines × 2) tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:259 — tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:259-274 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:244-260 — before extracting anything, compare `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:259` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16 lines × 4) · ×2
  • Duplicated block (16 lines × 4) src/common/meta/src/key/table_info.rs:222 — src/common/meta/src/key/table_info.rs:222-237 | src/common/meta/src/key/table_info.rs:254-269 | src/common/meta/src/key/view_info.rs:215-230 | src/common/meta/src/key/view_info.rs:247-262 — before extracting anything, compare `src/common/meta/src/key/table_info.rs` and `src/common/meta/src/key/view_info.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/table_info.rs:222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 4) src/promql/src/functions/native_histogram.rs:1121 — src/promql/src/functions/native_histogram.rs:1121-1136 | src/promql/src/functions/native_histogram.rs:1198-1213 | src/promql/src/functions/native_histogram.rs:2475-2490 | src/promql/src/functions/native_histogram.rs:2751-2766 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/native_histogram.rs:1121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) src/flow/src/batching_mode/frontend_client.rs:462 — src/flow/src/batching_mode/frontend_client.rs:462-476 | src/flow/src/batching_mode/frontend_client.rs:635-649 | src/flow/src/batching_mode/frontend_client.rs:723-737 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (15 lines × 3) src/meta-srv/src/selector/lease_based.rs:73 — src/meta-srv/src/selector/lease_based.rs:73-87 | src/meta-srv/src/selector/load_based.rs:105-119 | src/meta-srv/src/selector/round_robin.rs:136-150 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (14 lines × 5) · ×2
  • Duplicated block (14 lines × 5) src/common/function/src/scalars/vector/elem_avg.rs:36 — src/common/function/src/scalars/vector/elem_avg.rs:36-49 | src/common/function/src/scalars/vector/elem_product.rs:49-62 | src/common/function/src/scalars/vector/elem_sum.rs:36-49 | src/common/function/src/scalars/vector/vector_dim.rs:49-62 | src/common/function/src/scalars/vector/vector_norm.rs:52-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 5) src/pipeline/src/etl/processor/decolorize.rs:109 — src/pipeline/src/etl/processor/decolorize.rs:109-122 | src/pipeline/src/etl/processor/digest.rs:205-218 | src/pipeline/src/etl/processor/epoch.rs:185-198 | src/pipeline/src/etl/processor/gsub.rs:123-136 | src/pipeline/src/etl/processor/logfmt.rs:111-124 — before extracting anything, compare `src/pipeline/src/etl/processor/decolorize.rs` and `src/pipeline/src/etl/processor/digest.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/decolorize.rs:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) src/promql/src/functions/double_exponential_smoothing.rs:165 — src/promql/src/functions/double_exponential_smoothing.rs:165-178 | src/promql/src/functions/idelta.rs:82-95 | src/promql/src/functions/predict_linear.rs:83-96 | src/promql/src/functions/quantile.rs:81-94 — before extracting anything, compare `src/promql/src/functions/idelta.rs` and `src/promql/src/functions/quantile.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/promql/src/functions/double_exponential_smoothing.rs:165` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 4) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:292 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:292-305 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:276-289 | src/meta-srv/src/procedure/repartition/group/remap_manifest.rs:157-170 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:246-259 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:292` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×2
  • Duplicated block (13–14 lines × 3) src/common/meta/src/ddl/drop_table/executor.rs:320 — src/common/meta/src/ddl/drop_table/executor.rs:320-332 | src/common/meta/src/ddl/drop_table/executor.rs:361-374 | src/common/meta/src/ddl/drop_table/executor.rs:437-449 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/ddl/drop_table/executor.rs:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 3) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:81 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:81-93 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:71-84 | tests-fuzz/targets/fuzz_insert_logical_table.rs:83-95 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:82 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:82-93 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:83-96 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (12–14 lines × 2) src/pipeline/src/etl/processor/simple_extract.rs:51 — src/pipeline/src/etl/processor/simple_extract.rs:51-62 | src/pipeline/src/etl/processor/urlencoding.rs:90-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/simple_extract.rs:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×2
  • Duplicated block (12 lines × 4) src/catalog/src/system_schema/information_schema/compaction_tasks.rs:76 — src/catalog/src/system_schema/information_schema/compaction_tasks.rs:76-87 | src/catalog/src/system_schema/information_schema/ssts.rs:78-89 | src/catalog/src/system_schema/information_schema/ssts.rs:141-152 | src/catalog/src/system_schema/information_schema/ssts.rs:204-215 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/compaction_tasks.rs:76` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:340 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:340-351 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:323-334 | src/meta-srv/src/procedure/repartition/group/remap_manifest.rs:191-203 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:281-293 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×2
  • Duplicated block (8–11 lines × 2) src/mito2/src/read/flat_dedup.rs:215 — src/mito2/src/read/flat_dedup.rs:215-222 | src/mito2/src/read/flat_dedup.rs:457-467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/read/flat_dedup.rs:457` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–11 lines × 2) src/mito2/src/series_index/writer.rs:329 — src/mito2/src/series_index/writer.rs:329-339 | src/mito2/src/sst/range_index/writer.rs:350-357 — before extracting anything, compare `src/mito2/src/series_index/writer.rs` and `src/mito2/src/sst/range_index/writer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/series_index/writer.rs:329` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×2
  • Duplicated block (9–11 lines × 2) src/mito2/src/sst/index/bloom_filter/creator.rs:334 — src/mito2/src/sst/index/bloom_filter/creator.rs:334-342 | src/mito2/src/sst/index/inverted_index/creator.rs:366-376 — `src/mito2/src/sst/index/bloom_filter/creator.rs` and `src/mito2/src/sst/index/inverted_index/creator.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/bloom_filter/creator.rs:334` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–11 lines × 2) tests-fuzz/targets/ddl/fuzz_repartition_table.rs:279 — tests-fuzz/targets/ddl/fuzz_repartition_table.rs:279-287 | tests-fuzz/targets/ddl/fuzz_repartition_table.rs:314-324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×2
  • Duplicated block (7–9 lines × 3) src/common/function/src/admin/build_index_table.rs:95 — src/common/function/src/admin/build_index_table.rs:95-101 | src/common/function/src/admin/flush_compact_table.rs:68-74 | src/common/function/src/admin/purge_table.rs:54-62 — before extracting anything, compare `src/common/function/src/admin/flush_compact_table.rs` and `src/common/function/src/admin/purge_table.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/admin/build_index_table.rs:95` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7–9 lines × 3) src/common/function/src/scalars/geo/h3.rs:889 — src/common/function/src/scalars/geo/h3.rs:889-895 | src/common/function/src/scalars/geo/h3.rs:948-954 | src/common/function/src/scalars/geo/h3.rs:1071-1079 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/h3.rs:889` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×2
  • Duplicated block (8 lines × 6) src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:225 — src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:225-232 | src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs:253-260 | src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:277-284 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:262-269 | src/meta-srv/src/procedure/repartition/group/remap_manifest.rs:143-150 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:231-238 — before extracting anything, compare `src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs` and `src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:225` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 6) src/sql/src/parsers/alter_parser/trigger.rs:309 — src/sql/src/parsers/alter_parser/trigger.rs:309-317 | src/sql/src/parsers/alter_parser/trigger.rs:354-362 | src/sql/src/parsers/alter_parser/trigger.rs:399-407 | src/sql/src/parsers/create_parser/trigger.rs:166-174 | src/sql/src/parsers/create_parser/trigger.rs:387-394 | src/sql/src/parsers/create_parser/trigger.rs:428-435 — `src/sql/src/parsers/alter_parser/trigger.rs` and `src/sql/src/parsers/create_parser/trigger.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 54 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/sql/src/parsers/alter_parser/trigger.rs:309` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn parse_trigger_on(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×2
  • Duplicated block (8 lines × 4) src/common/function/src/scalars/ip/ipv6.rs:164 — src/common/function/src/scalars/ip/ipv6.rs:164-171 | src/common/function/src/scalars/json/json_get.rs:495-502 | src/common/function/src/scalars/json/parse_json.rs:60-67 | src/common/function/src/scalars/vector/convert/parse_vector.rs:61-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/ip/ipv6.rs:164` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) src/common/meta/src/reconciliation/reconcile_catalog.rs:153 — src/common/meta/src/reconciliation/reconcile_catalog.rs:153-160 | src/common/meta/src/reconciliation/reconcile_database.rs:193-200 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:181-188 | src/common/meta/src/reconciliation/reconcile_table.rs:280-287 — before extracting anything, compare `src/common/meta/src/reconciliation/reconcile_catalog.rs` and `src/common/meta/src/reconciliation/reconcile_database.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×2
  • Duplicated block (10 lines × 4) src/common/function/src/scalars/geo/geohash.rs:90 — src/common/function/src/scalars/geo/geohash.rs:90-99 | src/common/function/src/scalars/geo/geohash.rs:191-200 | src/common/function/src/scalars/geo/h3.rs:98-107 | src/common/function/src/scalars/geo/h3.rs:189-198 — before extracting anything, compare `src/common/function/src/scalars/geo/geohash.rs` and `src/common/function/src/scalars/geo/h3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 4) tests-fuzz/src/translator/mysql/alter_expr.rs:90 — tests-fuzz/src/translator/mysql/alter_expr.rs:90-99 | tests-fuzz/src/translator/mysql/create_expr.rs:62-71 | tests-fuzz/src/translator/postgres/alter_expr.rs:76-85 | tests-fuzz/src/translator/postgres/create_expr.rs:58-67 — `tests-fuzz/src/translator/mysql/alter_expr.rs` and `tests-fuzz/src/translator/postgres/alter_expr.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 10 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) src/datatypes/src/vectors/binary.rs:169 — src/datatypes/src/vectors/binary.rs:169-175 | src/datatypes/src/vectors/binary.rs:201-207 | src/datatypes/src/vectors/binary.rs:209-215 | src/datatypes/src/vectors/string.rs:154-160 — before extracting anything, compare `src/datatypes/src/vectors/binary.rs` and `src/datatypes/src/vectors/string.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 4) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:284 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:284-294 | tests-fuzz/targets/fuzz_insert_logical_table.rs:285-295 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:418-428 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:376-382 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:180 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:180-193 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:172-184 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:152-165 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:180` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 3) src/common/function/src/admin/flush_compact_table.rs:55 — src/common/function/src/admin/flush_compact_table.rs:55-67 | src/common/function/src/admin/purge_table.rs:42-55 | src/common/function/src/flush_flow.rs:60-72 — before extracting anything, compare `src/common/function/src/admin/flush_compact_table.rs` and `src/common/function/src/admin/purge_table.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/admin/flush_compact_table.rs:55` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: api — api: abstractness 0.00, instability 0.16, distance 0.84 — zone of pain — concrete and depended on by 32 project(s), so it's rigid to change.
  • Off the main sequence: object-store — object-store: abstractness 0.00, instability 0.26, distance 0.74 — zone of pain — concrete and depended on by 14 project(s), so it's rigid to change.
S1 · Web-Security Posture · Weak hash algorithm · ×2
  • Weak hash algorithm src/auth/src/common.rs:556 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
  • Weak hash algorithm src/auth/src/common.rs:563 — MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
AXR1 · Runtime accessibility (rendered) · WCAG 2.4.2 reproducibly failed in a rendered surface · ×1
  • WCAG 2.4.2 reproducibly failed in a rendered surface — axe-core rule(s) document-title failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
AXR1 · Runtime accessibility (rendered) · WCAG 3.1.1 reproducibly failed in a rendered surface · ×1
  • WCAG 3.1.1 reproducibly failed in a rendered surface — axe-core rule(s) html-has-lang failed on: html. Runtime evidence (advisory — not scored); fix and re-scan to verify it clears.
D1 · Cyclomatic Complexity · oswal-s3-bench-summary.render (cyclomatic 63) · ×1
  • oswal-s3-bench-summary.render (cyclomatic 63) .github/scripts/oswal-s3-bench-summary.py:341 — oswal-s3-bench-summary.render has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ScanMetricsSet · ×1
  • ScanMetricsSet::fmt (cyclomatic 59) src/mito2/src/read/scan_util.rs:291 — ScanMetricsSet::fmt has cyclomatic complexity 59 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Helper · ×1
  • Helper::try_into_vector (cyclomatic 46) src/datatypes/src/vectors/helper.rs:180 — Helper::try_into_vector has cyclomatic complexity 46 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ColumnDataTypeWrapper · ×1
  • ColumnDataTypeWrapper::try_from (cyclomatic 45) src/api/src/helper.rs:412 — ColumnDataTypeWrapper::try_from has cyclomatic complexity 45 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ScanbenchCommand · ×1
  • ScanbenchCommand::run (cyclomatic 42) src/cmd/src/datanode/scanbench.rs:771 — ScanbenchCommand::run has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Categorizer · ×1
  • Categorizer::check_plan (cyclomatic 41) src/query/src/dist_plan/commutativity.rs:97 — Categorizer::check_plan has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · o11ybench-storage.audit (cyclomatic 37) · ×1
  • o11ybench-storage.audit (cyclomatic 37) .github/scripts/o11ybench-storage.py:181 — o11ybench-storage.audit has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · oswal-s3-bench.group_cells (cyclomatic 36) · ×1
  • oswal-s3-bench.group_cells (cyclomatic 36) .github/scripts/oswal-s3-bench.py:208 — oswal-s3-bench.group_cells has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sql · ×1
  • sql::util::extract_tables_from_statement (cyclomatic 34) src/sql/src/util.rs:218 — sql::util::extract_tables_from_statement has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · api · ×1
  • api::helper::pb_value_to_value_ref (cyclomatic 33) src/api/src/helper.rs:764 — api::helper::pb_value_to_value_ref has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ci-slash.main (cyclomatic 32) · ×1
  • ci-slash.main (cyclomatic 32) .github/scripts/ci-slash.py:46 — ci-slash.main has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MysqlResultWriter · ×1
  • MysqlResultWriter::write_recordbatch (cyclomatic 31) src/servers/src/mysql/writer.rs:247 — MysqlResultWriter::write_recordbatch has cyclomatic complexity 31 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · RowWriter · ×1
  • RowWriter::write (cyclomatic 29) src/servers/src/http/prometheus.rs:1184 — RowWriter::write has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · HttpOutputWriter · ×1
  • HttpOutputWriter::write (cyclomatic 29) src/servers/src/http/result.rs:101 — HttpOutputWriter::write has cyclomatic complexity 29 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · LocalGcWorker · ×1
  • LocalGcWorker::do_region_gc (cyclomatic 28) src/mito2/src/gc.rs:436 — LocalGcWorker::do_region_gc has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · oswal-s3-bench-summary.load_cell (cyclomatic 27) · ×1
  • oswal-s3-bench-summary.load_cell (cyclomatic 27) .github/scripts/oswal-s3-bench-summary.py:182 — oswal-s3-bench-summary.load_cell has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tracesbench-summary.benchmark (cyclomatic 27) · ×1
  • tracesbench-summary.benchmark (cyclomatic 27) .github/scripts/tracesbench-summary.py:69 — tracesbench-summary.benchmark has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PagedCache · ×1
  • PagedCache::fetch (cyclomatic 26) src/common/cache/src/paged.rs:162 — PagedCache::fetch has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimplePredicate · ×1
  • SimplePredicate::cast_timestamp_unit (cyclomatic 26) src/common/recordbatch/src/filter/timestamp.rs:36 — SimplePredicate::cast_timestamp_unit has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · datatypes · ×1
  • datatypes::vectors::eq::equal (cyclomatic 26) src/datatypes/src/vectors/eq.rs:55 — datatypes::vectors::eq::equal has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ParquetbenchCommand · ×1
  • ParquetbenchCommand::run (cyclomatic 25) src/cmd/src/datanode/parquetbench.rs:166 — ParquetbenchCommand::run has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MergeScanExec · ×1
  • MergeScanExec::to_stream (cyclomatic 25) src/query/src/dist_plan/merge_scan.rs:617 — MergeScanExec::to_stream has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Value · ×1
  • Value::try_negative (cyclomatic 24) src/datatypes/src/value.rs:515 — Value::try_negative has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Value::try_from (cyclomatic 37) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · CoalescingBatcher · ×1
  • CoalescingBatcher::run (cyclomatic 24) src/servers/src/grpc/flight/stream.rs:214 — CoalescingBatcher::run has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · oswal-s3-bench-crash.verify (cyclomatic 24) · ×1
  • oswal-s3-bench-crash.verify (cyclomatic 24) .github/scripts/oswal-s3-bench-crash.py:134 — oswal-s3-bench-crash.verify has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkerRequest · ×1
  • WorkerRequest::try_from_region_request (cyclomatic 23) src/mito2/src/request.rs:856 — WorkerRequest::try_from_region_request has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · flow · ×1
  • flow::batching_mode::utils::merge_op_for_aggregate_expr (cyclomatic 22) src/flow/src/batching_mode/utils.rs:329 — flow::batching_mode::utils::merge_op_for_aggregate_expr has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MetricEngine · ×1
  • MetricEngine::handle_request (cyclomatic 22) src/metric-engine/src/engine.rs:211 — MetricEngine::handle_request has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · ParquetReaderBuilder · ×1
  • ParquetReaderBuilder::build_reader_input_inner (cyclomatic 22) src/mito2/src/sst/parquet/reader.rs:444 — ParquetReaderBuilder::build_reader_input_inner has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PartitionExpr · ×1
  • PartitionExpr::try_as_logical_expr (cyclomatic 22) src/partition/src/expr.rs:306 — PartitionExpr::try_as_logical_expr has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Operand::try_as_logical_expr (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · oswal-s3-bench.main (cyclomatic 22) · ×1
  • oswal-s3-bench.main (cyclomatic 22) .github/scripts/oswal-s3-bench.py:433 — oswal-s3-bench.main has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Runner · ×1
  • Runner::execute_once (cyclomatic 21) src/common/procedure/src/local/runner.rs:342 — Runner::execute_once has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BatchGcProcedure · ×1
  • BatchGcProcedure::get_file_references (cyclomatic 21) src/meta-srv/src/gc/procedure.rs:648 — BatchGcProcedure::get_file_references has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Pattern · ×1
  • Pattern::from_str (cyclomatic 21) src/pipeline/src/etl/processor/dissect.rs:206 — Pattern::from_str has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExtrapolatedRate · ×1
  • ExtrapolatedRate::calc (cyclomatic 21) src/promql/src/functions/extrapolate_rate.rs:132 — ExtrapolatedRate::calc has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WindowedSortStream · ×1
  • WindowedSortStream::poll_next_inner (cyclomatic 21) src/query/src/window_sort.rs:444 — WindowedSortStream::poll_next_inner has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PostgresServerHandlerInner · ×1
  • PostgresServerHandlerInner::on_startup (cyclomatic 21) src/servers/src/postgres/auth_handler.rs:279 — PostgresServerHandlerInner::on_startup has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AlterTableOperation · ×1
  • AlterTableOperation::fmt (cyclomatic 21) src/sql/src/statements/alter.rs:248 — AlterTableOperation::fmt has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · aws-ec2-runner-teardown.teardown (cyclomatic 21) · ×1
  • aws-ec2-runner-teardown.teardown (cyclomatic 21) .github/scripts/aws-ec2-runner-teardown.py:86 — aws-ec2-runner-teardown.teardown has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WriteDispatcher · ×1
  • WriteDispatcher::execute_tracked (cyclomatic 20) src/operator/src/write_dispatcher/progress.rs:117 — WriteDispatcher::execute_tracked has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LogQueryPlanner · ×1
  • LogQueryPlanner::build_content_filter_with_expr (cyclomatic 20) src/query/src/log_query/planner.rs:206 — LogQueryPlanner::build_content_filter_with_expr has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · cmd · ×1
  • cmd::datanode::parquet_rewrite::build_writer_properties (cyclomatic 19) src/cmd/src/datanode/parquet_rewrite.rs:265 — cmd::datanode::parquet_rewrite::build_writer_properties has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BatchingEngine · ×1
  • BatchingEngine::create_flow_inner (cyclomatic 19) src/flow/src/batching_mode/engine.rs:558 — BatchingEngine::create_flow_inner has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Batch · ×1
  • Batch::merge_last_non_null (cyclomatic 19) src/mito2/src/read.rs:507 — Batch::merge_last_non_null has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PlanRewriter · ×1
  • PlanRewriter::should_expand (cyclomatic 19) src/query/src/dist_plan/analyzer.rs:495 — PlanRewriter::should_expand has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CountNestAggrRule · ×1
  • CountNestAggrRule::try_rewrite_sort (cyclomatic 19) src/query/src/optimizer/count_nest_aggr.rs:68 — CountNestAggrRule::try_rewrite_sort has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · collect_context.collect_report (cyclomatic 19) · ×1
  • collect_context.collect_report (cyclomatic 19) .agents/skills/greptimedb-development-docker-image/scripts/collect_context.py:146 — collect_context.collect_report has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · o11ybench-storage.summary (cyclomatic 19) · ×1
  • o11ybench-storage.summary (cyclomatic 19) .github/scripts/o11ybench-storage.py:73 — o11ybench-storage.summary has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · o11ybench-storage.main (cyclomatic 19) · ×1
  • o11ybench-storage.main (cyclomatic 19) .github/scripts/o11ybench-storage.py:259 — o11ybench-storage.main has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PackIndex · ×1
  • PackIndex::validate (cyclomatic 18) src/common/datasource/src/packed_snapshot.rs:63 — PackIndex::validate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TraceColumnRequestSchema · ×1
  • TraceColumnRequestSchema::incompatible_schema_batches (cyclomatic 18) src/frontend/src/instance/otlp/trace_ingest.rs:933 — TraceColumnRequestSchema::incompatible_schema_batches has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Actor · ×1
  • Actor::run (cyclomatic 18) src/log-store/src/object_store_wal/store.rs:1600 — Actor::run has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TableMeta · ×1
  • TableMeta::set_table_options (cyclomatic 18) src/table/src/metadata.rs:358 — TableMeta::set_table_options has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent-observability-summary.benchmark (cyclomatic 18) · ×1
  • agent-observability-summary.benchmark (cyclomatic 18) .github/scripts/agent-observability-summary.py:85 — agent-observability-summary.benchmark has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agent-observability-summary.lifecycle (cyclomatic 18) · ×1
  • agent-observability-summary.lifecycle (cyclomatic 18) .github/scripts/agent-observability-summary.py:136 — agent-observability-summary.lifecycle has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Manifest · ×1
  • Manifest::validate_layout (cyclomatic 17) src/cli/src/data/export_v2/manifest.rs:286 — Manifest::validate_layout has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Import · ×1
  • Import::run (cyclomatic 17) src/cli/src/data/import_v2/command.rs:209 — Import::run has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · FulltextOptions · ×1
  • FulltextOptions::try_from (cyclomatic 17) src/datatypes/src/schema/column_schema.rs:905 — FulltextOptions::try_from has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · EntityGraphProviderImpl · ×1
  • EntityGraphProviderImpl::enumerate (cyclomatic 17) src/frontend/src/instance/entity_graph.rs:386 — EntityGraphProviderImpl::enumerate has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MetasrvBuilder · ×1
  • MetasrvBuilder::build (cyclomatic 17) src/meta-srv/src/metasrv/builder.rs:213 — MetasrvBuilder::build has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Metasrv · ×1
  • Metasrv::try_start_after_gc_check (cyclomatic 17) src/meta-srv/src/metasrv.rs:645 — Metasrv::try_start_after_gc_check has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SharedRange · ×1
  • SharedRange::read (cyclomatic 17) src/mito2/src/cache/range_cache/shared_range.rs:110 — SharedRange::read has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Collider · ×1
  • Collider::try_create_nucleon (cyclomatic 17) src/partition/src/collider.rs:381 — Collider::try_create_nucleon has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · partition · ×1
  • partition::simplify::simplify_terms (cyclomatic 17) src/partition/src/simplify.rs:297 — partition::simplify::simplify_terms has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AlterKind · ×1
  • AlterKind::validate (cyclomatic 17) src/store-api/src/region_request.rs:999 — AlterKind::validate has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This is NOT this file's highest cyclomatic complexity: RegionRequest::try_from_request_body (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · query-regression-run.run_direct_case (cyclomatic 17) · ×1
  • query-regression-run.run_direct_case (cyclomatic 17) .github/scripts/query-regression-run.py:323 — query-regression-run.run_direct_case has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExportCreateCommand · ×1
  • ExportCreateCommand::build (cyclomatic 16) src/cli/src/data/export_v2/command.rs:343 — ExportCreateCommand::build has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ParquetFetchMetrics · ×1
  • ParquetFetchMetrics::fmt (cyclomatic 16) src/mito2/src/sst/parquet/row_group.rs:71 — ParquetFetchMetrics::fmt has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DissectProcessor · ×1
  • DissectProcessor::process_pattern (cyclomatic 16) src/pipeline/src/etl/processor/dissect.rs:448 — DissectProcessor::process_pattern has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · DataFusionExprConverter · ×1
  • DataFusionExprConverter::convert (cyclomatic 16) src/query/src/dist_plan/predicate_extractor.rs:269 — DataFusionExprConverter::convert has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · RangeSelectStream · ×1
  • RangeSelectStream::generate_output (cyclomatic 16) src/query/src/range_select/plan.rs:1095 — RangeSelectStream::generate_output has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SetRegionOption · ×1
  • SetRegionOption::try_from (cyclomatic 16) src/store-api/src/region_request.rs:1744 — SetRegionOption::try_from has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: RegionRequest::try_from_request_body (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · benchmark-version-comparison.traces (cyclomatic 16) · ×1
  • benchmark-version-comparison.traces (cyclomatic 16) .github/scripts/benchmark-version-comparison.py:85 — benchmark-version-comparison.traces has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · query-regression-slash.admit_pull (cyclomatic 16) · ×1
  • query-regression-slash.admit_pull (cyclomatic 16) .github/scripts/query-regression-slash.py:353 — query-regression-slash.admit_pull has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · query-regression-summary.build_markdown (cyclomatic 16) · ×1
  • query-regression-summary.build_markdown (cyclomatic 16) .github/scripts/query-regression-summary.py:171 — query-regression-summary.build_markdown has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D12 · Dependency Hygiene · Yanked release · ×1
  • Yanked release: mysql — `mysql` resolves to 28.0.0 in the committed REDACTED, and crates.io reports that release as YANKED. A yanked release is one the publisher has withdrawn and asked you to stop using; it keeps resolving only so existing locks do not break. The current stable release is 28.0.4. Run `cargo update -p mysql` and commit the updated lock.
D2 · Cognitive Complexity · oswal-s3-bench-summary.render (cognitive 119) · ×1
  • oswal-s3-bench-summary.render (cognitive 119) .github/scripts/oswal-s3-bench-summary.py:341 — oswal-s3-bench-summary.render has cognitive complexity 119 (threshold 15). Drivers by points: ternaries 19 (56 pts), loops 13 (26 pts), if/else 19 (25 pts), boolean chains 12 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanbenchCommand · ×1
  • ScanbenchCommand::run (cognitive 77) src/cmd/src/datanode/scanbench.rs:771 — ScanbenchCommand::run has cognitive complexity 77 (threshold 15). Drivers by points: if/else 30 (48 pts), loops 7 (16 pts), match/switch 5 (10 pts), boolean chains 3 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanMetricsSet · ×1
  • ScanMetricsSet::fmt (cognitive 69) src/mito2/src/read/scan_util.rs:291 — ScanMetricsSet::fmt has cognitive complexity 69 (threshold 15). Drivers by points: if/else 49 (58 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · o11ybench-storage.audit (cognitive 64) · ×1
  • o11ybench-storage.audit (cognitive 64) .github/scripts/o11ybench-storage.py:181 — o11ybench-storage.audit has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (36 pts), loops 9 (16 pts), boolean chains 8, ternaries 3 (4 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tracesbench-summary.benchmark (cognitive 63) · ×1
  • tracesbench-summary.benchmark (cognitive 63) .github/scripts/tracesbench-summary.py:69 — tracesbench-summary.benchmark has cognitive complexity 63 (threshold 15). Drivers by points: if/else 8 (24 pts), ternaries 6 (23 pts), loops 5 (9 pts), boolean chains 7 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · oswal-s3-bench.group_cells (cognitive 57) · ×1
  • oswal-s3-bench.group_cells (cognitive 57) .github/scripts/oswal-s3-bench.py:208 — oswal-s3-bench.group_cells has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 9 (19 pts), loops 4 (10 pts), boolean chains 9 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PagedCache · ×1
  • PagedCache::fetch (cognitive 55) src/common/cache/src/paged.rs:162 — PagedCache::fetch has cognitive complexity 55 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 10 (20 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Batch · ×1
  • Batch::merge_last_non_null (cognitive 54) src/mito2/src/read.rs:507 — Batch::merge_last_non_null has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 7 (17 pts), boolean chains 1 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CoalescingBatcher · ×1
  • CoalescingBatcher::run (cognitive 49) src/servers/src/grpc/flight/stream.rs:214 — CoalescingBatcher::run has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 3 (5 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Runner · ×1
  • Runner::execute_once (cognitive 46) src/common/procedure/src/local/runner.rs:342 — Runner::execute_once has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (38 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 29). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · WindowedSortStream · ×1
  • WindowedSortStream::poll_next_inner (cognitive 46) src/query/src/window_sort.rs:444 — WindowedSortStream::poll_next_inner has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (38 pts), match/switch 3 (5 pts), loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ci-slash.main (cognitive 46) · ×1
  • ci-slash.main (cognitive 46) .github/scripts/ci-slash.py:46 — ci-slash.main has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 9, loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · o11ybench-storage.summary (cognitive 44) · ×1
  • o11ybench-storage.summary (cognitive 44) .github/scripts/o11ybench-storage.py:73 — o11ybench-storage.summary has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 8 (25 pts), if/else 6 (9 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExtrapolatedRate · ×1
  • ExtrapolatedRate::calc (cognitive 41) src/promql/src/functions/extrapolate_rate.rs:132 — ExtrapolatedRate::calc has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (31 pts), match/switch 2 (7 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalGcWorker · ×1
  • LocalGcWorker::do_region_gc (cognitive 39) src/mito2/src/gc.rs:436 — LocalGcWorker::do_region_gc has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 12 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · oswal-s3-bench-summary.load_cell (cognitive 39) · ×1
  • oswal-s3-bench-summary.load_cell (cognitive 39) .github/scripts/oswal-s3-bench-summary.py:182 — oswal-s3-bench-summary.load_cell has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 14 (23 pts), if/else 7 (11 pts), boolean chains 3, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Pruner · ×1
  • Pruner::worker_loop (cognitive 37) src/mito2/src/read/pruner.rs:626 — Pruner::worker_loop has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · aws-ec2-runner-teardown.teardown (cognitive 36) · ×1
  • aws-ec2-runner-teardown.teardown (cognitive 36) .github/scripts/aws-ec2-runner-teardown.py:86 — aws-ec2-runner-teardown.teardown has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, error handling 2 (5 pts), ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InformationSchemaStatisticsBuilder · ×1
  • InformationSchemaStatisticsBuilder::make_statistics (cognitive 35) src/catalog/src/system_schema/information_schema/statistics.rs:237 — InformationSchemaStatisticsBuilder::make_statistics has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (20 pts), loops 4 (9 pts), match/switch 1 (5 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParquetbenchCommand · ×1
  • ParquetbenchCommand::run (cognitive 35) src/cmd/src/datanode/parquetbench.rs:166 — ParquetbenchCommand::run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 4, loops 2 (4 pts), match/switch 3 (4 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FlowDualEngine · ×1
  • FlowDualEngine::check_flow_consistent (cognitive 35) src/flow/src/adapter/flownode_impl.rs:275 — FlowDualEngine::check_flow_consistent has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 5 (14 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · oswal-s3-bench-summary.ratios (cognitive 35) · ×1
  • oswal-s3-bench-summary.ratios (cognitive 35) .github/scripts/oswal-s3-bench-summary.py:268 — oswal-s3-bench-summary.ratios has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (10 pts), ternaries 2 (9 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SharedRange · ×1
  • SharedRange::read (cognitive 33) src/mito2/src/cache/range_cache/shared_range.rs:110 — SharedRange::read has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (7 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CountdownTask · ×1
  • CountdownTask::run (cognitive 32) src/datanode/src/alive_keeper.rs:425 — CountdownTask::run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (21 pts), match/switch 3 (9 pts), boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EntityGraphProviderImpl · ×1
  • EntityGraphProviderImpl::enumerate (cognitive 32) src/frontend/src/instance/entity_graph.rs:386 — EntityGraphProviderImpl::enumerate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · oswal-s3-bench-crash.verify (cognitive 32) · ×1
  • oswal-s3-bench-crash.verify (cognitive 32) .github/scripts/oswal-s3-bench-crash.py:134 — oswal-s3-bench-crash.verify has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 5 (8 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update-compat-versions.published_release_tags (cognitive 32) · ×1
  • update-compat-versions.published_release_tags (cognitive 32) .github/scripts/update-compat-versions.py:203 — update-compat-versions.published_release_tags has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ColumnDataTypeWrapper · ×1
  • ColumnDataTypeWrapper::try_from (cognitive 31) src/api/src/helper.rs:412 — ColumnDataTypeWrapper::try_from has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 6 (11 pts), loops 1 (3 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AccessLayer · ×1
  • AccessLayer::write_sst_inner (cognitive 31) src/mito2/src/access_layer.rs:396 — AccessLayer::write_sst_inner has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 3 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Categorizer · ×1
  • Categorizer::check_plan (cognitive 31) src/query/src/dist_plan/commutativity.rs:97 — Categorizer::check_plan has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agent-observability-summary.benchmark (cognitive 31) · ×1
  • agent-observability-summary.benchmark (cognitive 31) .github/scripts/agent-observability-summary.py:85 — agent-observability-summary.benchmark has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 5 (11 pts), loops 6 (10 pts), if/else 3 (7 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manifest · ×1
  • Manifest::validate_layout (cognitive 30) src/cli/src/data/export_v2/manifest.rs:286 — Manifest::validate_layout has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 5, loops 2 (5 pts), match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · common_telemetry · ×1
  • common_telemetry::metric::convert_metric_to_write_request (cognitive 30) src/common/telemetry/src/metric.rs:48 — common_telemetry::metric::convert_metric_to_write_request has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (11 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Metasrv · ×1
  • Metasrv::try_start_after_gc_check (cognitive 30) src/meta-srv/src/metasrv.rs:645 — Metasrv::try_start_after_gc_check has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2 (7 pts), loops 3 (6 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark_resource_summary.render_resources (cognitive 30) · ×1
  • benchmark_resource_summary.render_resources (cognitive 30) .github/scripts/benchmark_resource_summary.py:66 — benchmark_resource_summary.render_resources has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 2 (6 pts), loops 3 (6 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TraceColumnRequestSchema · ×1
  • TraceColumnRequestSchema::incompatible_schema_batches (cognitive 29) src/frontend/src/instance/otlp/trace_ingest.rs:933 — TraceColumnRequestSchema::incompatible_schema_batches has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 6 (9 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DissectProcessor · ×1
  • DissectProcessor::process_pattern (cognitive 29) src/pipeline/src/etl/processor/dissect.rs:448 — DissectProcessor::process_pattern has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (10 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GreptimeTransformer · ×1
  • GreptimeTransformer::transform_mut_with_schema (cognitive 29) src/pipeline/src/etl/transform/transformer/greptime.rs:233 — GreptimeTransformer::transform_mut_with_schema has cognitive complexity 29 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 3 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlightRecordBatchStream · ×1
  • FlightRecordBatchStream::verbose_metrics_stream (cognitive 29) src/servers/src/grpc/flight/stream.rs:544 — FlightRecordBatchStream::verbose_metrics_stream has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventPayloadResolver · ×1
  • EventPayloadResolver::parse_payload (cognitive 29) src/servers/src/http/event.rs:889 — EventPayloadResolver::parse_payload has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DirtyTimeWindows · ×1
  • DirtyTimeWindows::gen_filter_exprs (cognitive 28) src/flow/src/batching_mode/state.rs:630 — DirtyTimeWindows::gen_filter_exprs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManifestContext · ×1
  • ManifestContext::set_role (cognitive 28) src/mito2/src/region.rs:2081 — ManifestContext::set_role has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 4 (7 pts) (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ParquetReaderBuilder · ×1
  • ParquetReaderBuilder::build_reader_input_inner (cognitive 28) src/mito2/src/sst/parquet/reader.rs:444 — ParquetReaderBuilder::build_reader_input_inner has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · MetasrvBuilder · ×1
  • MetasrvBuilder::build (cognitive 27) src/meta-srv/src/metasrv/builder.rs:213 — MetasrvBuilder::build has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20 (22 pts), match/switch 3, boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PutRecordBatchRequestStream · ×1
  • PutRecordBatchRequestStream::poll_next (cognitive 27) src/servers/src/grpc/flight.rs:433 — PutRecordBatchRequestStream::poll_next has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 6 (21 pts), if/else 2 (5 pts), loops 1 (nesting depth added 18). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MysqlResultWriter · ×1
  • MysqlResultWriter::write_recordbatch (cognitive 27) src/servers/src/mysql/writer.rs:247 — MysqlResultWriter::write_recordbatch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 2 (7 pts), loops 3 (5 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlterTrigger · ×1
  • AlterTrigger::fmt (cognitive 27) src/sql/src/statements/alter/trigger.rs:37 — AlterTrigger::fmt has cognitive complexity 27 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 6 (8 pts), match/switch 3 (6 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Json2Options · ×1
  • Json2Options::fmt (cognitive 27) src/sql/src/statements/create.rs:180 — Json2Options::fmt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · table · ×1
  • table::requests::validate_and_normalize_annotation (cognitive 27) src/table/src/requests.rs:603 — table::requests::validate_and_normalize_annotation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · agent-observability-summary.lifecycle (cognitive 27) · ×1
  • agent-observability-summary.lifecycle (cognitive 27) .github/scripts/agent-observability-summary.py:136 — agent-observability-summary.lifecycle has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (15 pts), boolean chains 5, loops 4 (5 pts), if/else 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Import · ×1
  • Import::run (cognitive 26) src/cli/src/data/import_v2/command.rs:209 — Import::run has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), loops 2 (5 pts), boolean chains 2, match/switch 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PackIndex · ×1
  • PackIndex::validate (cognitive 26) src/common/datasource/src/packed_snapshot.rs:63 — PackIndex::validate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Dispatch · ×1
  • Dispatch::dispatch_migrations (cognitive 26) src/meta-srv/src/procedure/drain_datanode/dispatch.rs:150 — Dispatch::dispatch_migrations has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (19 pts), match/switch 2 (4 pts), loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metric_engine · ×1
  • metric_engine::batch_modifier::compute_tsid_array (cognitive 26) src/metric-engine/src/batch_modifier.rs:50 — metric_engine::batch_modifier::compute_tsid_array has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (11 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndexerBuilderImpl · ×1
  • IndexerBuilderImpl::build (cognitive 26) src/mito2/src/sst/index.rs:518 — IndexerBuilderImpl::build has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PromWriteRequest · ×1
  • PromWriteRequest::decode (cognitive 26) src/servers/src/prom_remote_write/decode.rs:269 — PromWriteRequest::decode has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlatLastNonNull · ×1
  • FlatLastNonNull::dedup_by_partitions (cognitive 25) src/mito2/src/read/flat_dedup.rs:478 — FlatLastNonNull::dedup_by_partitions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · oswal-s3-bench-summary.image_ratios (cognitive 25) · ×1
  • oswal-s3-bench-summary.image_ratios (cognitive 25) .github/scripts/oswal-s3-bench-summary.py:294 — oswal-s3-bench-summary.image_ratios has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (15 pts), boolean chains 4, if/else 2 (3 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · query-regression-run.run_direct_case (cognitive 25) · ×1
  • query-regression-run.run_direct_case (cognitive 25) .github/scripts/query-regression-run.py:323 — query-regression-run.run_direct_case has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 7 (9 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ManifestCache · ×1
  • ManifestCache::remove_empty_dirs_recursive_sync (cognitive 24) src/mito2/src/cache/manifest_cache.rs:400 — ManifestCache::remove_empty_dirs_recursive_sync has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DefaultCompactor · ×1
  • DefaultCompactor::merge_ssts (cognitive 24) src/mito2/src/compaction/compactor.rs:851 — DefaultCompactor::merge_ssts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 5 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CheckpointStorage · ×1
  • CheckpointStorage::load_checkpoint (cognitive 24) src/mito2/src/manifest/storage/checkpoint.rs:98 — CheckpointStorage::load_checkpoint has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BloomFilterIndexer · ×1
  • BloomFilterIndexer::do_update_flat (cognitive 24) src/mito2/src/sst/index/bloom_filter/creator.rs:355 — BloomFilterIndexer::do_update_flat has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (9 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PartSortStream · ×1
  • PartSortStream::poll_next_inner (cognitive 24) src/query/src/part_sort.rs:1168 — PartSortStream::poll_next_inner has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark-version-comparison.traces (cognitive 24) · ×1
  • benchmark-version-comparison.traces (cognitive 24) .github/scripts/benchmark-version-comparison.py:85 — benchmark-version-comparison.traces has cognitive complexity 24 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 8, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · o11ybench-storage.main (cognitive 24) · ×1
  • o11ybench-storage.main (cognitive 24) .github/scripts/o11ybench-storage.py:259 — o11ybench-storage.main has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · oswal-s3-bench.main (cognitive 24) · ×1
  • oswal-s3-bench.main (cognitive 24) .github/scripts/oswal-s3-bench.py:433 — oswal-s3-bench.main has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 7 (8 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ipv4ToCidr · ×1
  • Ipv4ToCidr::invoke_with_args (cognitive 23) src/common/function/src/scalars/ip/cidr.rs:78 — Ipv4ToCidr::invoke_with_args has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegexpExtractFunction · ×1
  • RegexpExtractFunction::invoke_with_args (cognitive 23) src/common/function/src/scalars/string/regexp_extract.rs:94 — RegexpExtractFunction::invoke_with_args has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimplePredicate · ×1
  • SimplePredicate::cast_timestamp_unit (cognitive 23) src/common/recordbatch/src/filter/timestamp.rs:36 — SimplePredicate::cast_timestamp_unit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · KafkaLogStore · ×1
  • KafkaLogStore::read (cognitive 23) src/log-store/src/kafka/log_store.rs:309 — KafkaLogStore::read has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RangeManipulateStream · ×1
  • RangeManipulateStream::manipulate (cognitive 23) src/promql/src/extension_plan/range_manipulate.rs:684 — RangeManipulateStream::manipulate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 3 (5 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · common_datasource · ×1
  • common_datasource::file_format::csv::tolerant_csv_stream_from_reader (cognitive 22) src/common/datasource/src/file_format/csv.rs:276 — common_datasource::file_format::csv::tolerant_csv_stream_from_reader has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingEngine · ×1
  • StreamingEngine::handle_inserts_inner (cognitive 22) src/flow/src/adapter.rs:1065 — StreamingEngine::handle_inserts_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (3 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FindGroupByFinalName · ×1
  • FindGroupByFinalName::f_up (cognitive 22) src/flow/src/batching_mode/utils.rs:1234 — FindGroupByFinalName::f_up has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WriteRetry · ×1
  • WriteRetry::retry (cognitive 22) src/operator/src/write_dispatcher.rs:540 — WriteRetry::retry has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (4 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ci_scope.fetch_changed_files (cognitive 22) · ×1
  • ci_scope.fetch_changed_files (cognitive 22) .github/ci/ci_scope.py:175 — ci_scope.fetch_changed_files has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · build-ecs-image.main (cognitive 22) · ×1
  • build-ecs-image.main (cognitive 22) .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py:303 — build-ecs-image.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 pts), loops 3, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · benchmark-version-comparison.long_range (cognitive 22) · ×1
  • benchmark-version-comparison.long_range (cognitive 22) .github/scripts/benchmark-version-comparison.py:115 — benchmark-version-comparison.long_range has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (11 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Ipv6NumToString · ×1
  • Ipv6NumToString::invoke_with_args (cognitive 21) src/common/function/src/scalars/ip/ipv6.rs:61 — Ipv6NumToString::invoke_with_args has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConcreteDataType · ×1
  • ConcreteDataType::from (cognitive 21) src/api/src/helper.rs:113 — ConcreteDataType::from has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2 (3 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ManifestObjectStore · ×1
  • ManifestObjectStore::delete_until (cognitive 21) src/mito2/src/manifest/storage.rs:307 — ManifestObjectStore::delete_until has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 2 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TimePartitions · ×1
  • TimePartitions::find_partitions_by_time_range (cognitive 21) src/mito2/src/memtable/time_partition.rs:545 — TimePartitions::find_partitions_by_time_range has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionLoadCacheTask · ×1
  • RegionLoadCacheTask::fill_cache (cognitive 21) src/mito2/src/region/opener.rs:1133 — RegionLoadCacheTask::fill_cache has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParquetWriter · ×1
  • ParquetWriter::write_all_flat_inner (cognitive 21) src/mito2/src/sst/parquet/writer.rs:550 — ParquetWriter::write_all_flat_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScanHintRewriter · ×1
  • ScanHintRewriter::extract_last_value_selector (cognitive 21) src/query/src/optimizer/scan_hint.rs:401 — ScanHintRewriter::extract_last_value_selector has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MysqlInstanceShim · ×1
  • MysqlInstanceShim::on_query (cognitive 21) src/servers/src/mysql/handler.rs:665 — MysqlInstanceShim::on_query has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 6 (9 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · collect_context.collect_report (cognitive 21) · ×1
  • collect_context.collect_report (cognitive 21) .agents/skills/greptimedb-development-docker-image/scripts/collect_context.py:146 — collect_context.collect_report has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 6, boolean chains 5, error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · OpenDalStorage · ×1
  • OpenDalStorage::prepare_export_chunk (cognitive 20) src/cli/src/data/snapshot_storage.rs:748 — OpenDalStorage::prepare_export_chunk has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (4 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlatLastTimestampSelector · ×1
  • FlatLastTimestampSelector::on_next (cognitive 20) src/mito2/src/read/last_row.rs:319 — FlatLastTimestampSelector::on_next has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileMeta · ×1
  • FileMeta::is_index_consistent_with_region (cognitive 20) src/mito2/src/sst/file.rs:540 — FileMeta::is_index_consistent_with_region has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AbsentStream · ×1
  • AbsentStream::poll_next (cognitive 20) src/promql/src/extension_plan/absent.rs:473 — AbsentStream::poll_next has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 3 (6 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Export · ×1
  • Export::get_table_list (cognitive 19) src/cli/src/data/export.rs:257 — Export::get_table_list has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CountHashGroupAccumulator · ×1
  • CountHashGroupAccumulator::update_batch (cognitive 19) src/common/function/src/aggrs/count_hash.rs:194 — CountHashGroupAccumulator::update_batch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TraceChunkRetry · ×1
  • TraceChunkRetry::try_new (cognitive 19) src/frontend/src/instance/otlp/trace_ingest.rs:384 — TraceChunkRetry::try_new has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EngineInner · ×1
  • EngineInner::scan_region (cognitive 19) src/mito2/src/engine.rs:1181 — EngineInner::scan_region has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SeriesNormalizeStream · ×1
  • SeriesNormalizeStream::normalize (cognitive 19) src/promql/src/extension_plan/normalize.rs:408 — SeriesNormalizeStream::normalize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InfluxdbV1Response · ×1
  • InfluxdbV1Response::from_output (cognitive 19) src/servers/src/http/result/influxdb_result_v1.rs:136 — InfluxdbV1Response::from_output has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 5 (18 pts), loops 1 (nesting depth added 13). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · update-compat-versions.main (cognitive 19) · ×1
  • update-compat-versions.main (cognitive 19) .github/scripts/update-compat-versions.py:406 — update-compat-versions.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExportCreateCommand · ×1
  • ExportCreateCommand::build (cognitive 18) src/cli/src/data/export_v2/command.rs:343 — ExportCreateCommand::build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VectorSum · ×1
  • VectorSum::update_batch (cognitive 18) src/common/function/src/aggrs/vector/sum.rs:102 — VectorSum::update_batch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ErrorVariant · ×1
  • ErrorVariant::from_enum_variant (cognitive 18) src/common/macro/src/stack_trace_debug.rs:127 — ErrorVariant::from_enum_variant has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProcedureStore · ×1
  • ProcedureStore::load_messages (cognitive 18) src/common/procedure/src/store.rs:237 — ProcedureStore::load_messages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FulltextOptions · ×1
  • FulltextOptions::try_from (cognitive 18) src/datatypes/src/schema/column_schema.rs:905 — FulltextOptions::try_from has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 5, boolean chains 1 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · HeartbeatRunner · ×1
  • HeartbeatRunner::report_heartbeats (cognitive 18) src/frontend/src/heartbeat.rs:448 — HeartbeatRunner::report_heartbeats has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InfluxdbLineTimestampAligner · ×1
  • InfluxdbLineTimestampAligner::align_timestamps (cognitive 18) src/frontend/src/instance/influxdb.rs:108 — InfluxdbLineTimestampAligner::align_timestamps has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GcScheduler · ×1
  • GcScheduler::select_gc_candidates (cognitive 18) src/meta-srv/src/gc/candidate.rs:68 — GcScheduler::select_gc_candidates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValueBuilder · ×1
  • ValueBuilder::extend (cognitive 18) src/mito2/src/memtable/time_series.rs:1050 — ValueBuilder::extend has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), match/switch 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionOpener · ×1
  • RegionOpener::maybe_open (cognitive 18) src/mito2/src/region/opener.rs:524 — RegionOpener::maybe_open has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · EnforceDistRequirementRewriter · ×1
  • EnforceDistRequirementRewriter::get_current_applicable_column_requirements (cognitive 18) src/query/src/dist_plan/analyzer.rs:861 — EnforceDistRequirementRewriter::get_current_applicable_column_requirements has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataFusionExprConverter · ×1
  • DataFusionExprConverter::convert (cognitive 18) src/query/src/dist_plan/predicate_extractor.rs:269 — DataFusionExprConverter::convert has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · CountNestAggrRule · ×1
  • CountNestAggrRule::try_rewrite_sort (cognitive 18) src/query/src/optimizer/count_nest_aggr.rs:68 — CountNestAggrRule::try_rewrite_sort has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, boolean chains 2, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WindowedSortPhysicalRule · ×1
  • WindowedSortPhysicalRule::do_optimize (cognitive 18) src/query/src/optimizer/windowed_sort.rs:68 — WindowedSortPhysicalRule::do_optimize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExpandIntervalTransformRule · ×1
  • ExpandIntervalTransformRule::visit_expr (cognitive 18) src/sql/src/statements/transform/expand_interval.rs:71 — ExpandIntervalTransformRule::visit_expr has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 4 (9 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · oswal-s3-bench-summary.parse_metrics (cognitive 18) · ×1
  • oswal-s3-bench-summary.parse_metrics (cognitive 18) .github/scripts/oswal-s3-bench-summary.py:40 — oswal-s3-bench-summary.parse_metrics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 7, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · query-regression-run.prepare_targets (cognitive 18) · ×1
  • query-regression-run.prepare_targets (cognitive 18) .github/scripts/query-regression-run.py:709 — query-regression-run.prepare_targets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · common_base · ×1
  • common_base::term_token::for_each_word_run (cognitive 17) src/common/base/src/term_token.rs:89 — common_base::term_token::for_each_word_run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PatternAst · ×1
  • PatternAst::eliminate_optional_fn (cognitive 17) src/common/function/src/scalars/matches.rs:280 — PatternAst::eliminate_optional_fn has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 2 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Tokenizer · ×1
  • Tokenizer::tokenize (cognitive 17) src/common/function/src/scalars/matches.rs:730 — Tokenizer::tokenize has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · DatanodeBuilder · ×1
  • DatanodeBuilder::build_inner (cognitive 17) src/datanode/src/datanode.rs:347 — DatanodeBuilder::build_inner has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Consumer · ×1
  • Consumer::poll_next (cognitive 17) src/log-store/src/kafka/consumer.rs:192 — Consumer::poll_next has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Actor · ×1
  • Actor::on_delete_completed (cognitive 17) src/log-store/src/object_store_wal/store.rs:2679 — Actor::on_delete_completed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RaftEngineLogStore · ×1
  • RaftEngineLogStore::read (cognitive 17) src/log-store/src/raft_engine/log_store.rs:378 — RaftEngineLogStore::read has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 3 (7 pts), loops 2 (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · FlatProjectionMapper · ×1
  • FlatProjectionMapper::convert (cognitive 17) src/mito2/src/read/flat_projection.rs:306 — FlatProjectionMapper::convert has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MultiDimPartitionRule · ×1
  • MultiDimPartitionRule::split_record_batch (cognitive 17) src/partition/src/multi_dim.rs:259 — MultiDimPartitionRule::split_record_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, loops 2 (4 pts), match/switch 3, boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · IDelta · ×1
  • IDelta::calc (cognitive 17) src/promql/src/functions/idelta.rs:63 — IDelta::calc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LogQueryPlanner · ×1
  • LogQueryPlanner::build_content_filter_with_expr (cognitive 17) src/query/src/log_query/planner.rs:206 — LogQueryPlanner::build_content_filter_with_expr has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2 (3 pts) (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LogicalTablePendingRowsBatcher · ×1
  • LogicalTablePendingRowsBatcher::accepts_bulk_destinations (cognitive 17) src/servers/src/batcher/logical_table.rs:217 — LogicalTablePendingRowsBatcher::accepts_bulk_destinations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TablePendingRowsBatcher · ×1
  • TablePendingRowsBatcher::submit (cognitive 17) src/servers/src/batcher/table.rs:170 — TablePendingRowsBatcher::submit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session · ×1
  • session::query_options::parse_query_option (cognitive 17) src/session/src/query_options.rs:37 — session::query_options::parse_query_option has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 4 (7 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionMetadata · ×1
  • RegionMetadata::validate (cognitive 17) src/store-api/src/metadata.rs:429 — RegionMetadata::validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · image_config.update_env (cognitive 17) · ×1
  • image_config.update_env (cognitive 17) .agents/skills/greptimedb-development-docker-image/scripts/image_config.py:115 — image_config.update_env has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (6 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ci_scope.glob_to_regex (cognitive 17) · ×1
  • ci_scope.glob_to_regex (cognitive 17) .github/ci/ci_scope.py:107 — ci_scope.glob_to_regex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ci_scope_rules.validate (cognitive 17) · ×1
  • ci_scope_rules.validate (cognitive 17) .github/ci/ci_scope_rules.py:76 — ci_scope_rules.validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · jsonbench-summary.parse_query_rows (cognitive 17) · ×1
  • jsonbench-summary.parse_query_rows (cognitive 17) .github/scripts/jsonbench-summary.py:74 — jsonbench-summary.parse_query_rows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 2 (4 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · query-regression-run.main (cognitive 17) · ×1
  • query-regression-run.main (cognitive 17) .github/scripts/query-regression-run.py:757 — query-regression-run.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, error handling 3 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · query-regression-summary.build_markdown (cognitive 17) · ×1
  • query-regression-summary.build_markdown (cognitive 17) .github/scripts/query-regression-summary.py:171 — query-regression-summary.build_markdown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 7, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · tracesbench-summary.lifecycle (cognitive 17) · ×1
  • tracesbench-summary.lifecycle (cognitive 17) .github/scripts/tracesbench-summary.py:122 — tracesbench-summary.lifecycle has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 2 (6 pts), if/else 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · client · ×1
  • client::database::output_from_flight_message_stream (cognitive 16) src/client/src/database.rs:382 — client::database::output_from_flight_message_stream has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 4 (11 pts), if/else 2 (3 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StateMergeHelper · ×1
  • StateMergeHelper::split_aggr_node (cognitive 16) src/common/function/src/aggrs/aggr_wrapper.rs:171 — StateMergeHelper::split_aggr_node has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MatchesTermFunction · ×1
  • MatchesTermFunction::invoke_with_args (cognitive 16) src/common/function/src/scalars/matches_term.rs:115 — MatchesTermFunction::invoke_with_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MatchesTermFinder · ×1
  • MatchesTermFinder::find (cognitive 16) src/common/function/src/scalars/matches_term.rs:297 — MatchesTermFinder::find has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocateFunction · ×1
  • LocateFunction::invoke_with_args (cognitive 16) src/common/function/src/scalars/string/locate.rs:116 — LocateFunction::invoke_with_args has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · datanode · ×1
  • datanode::datanode::open_all_regions (cognitive 16) src/datanode/src/datanode.rs:1085 — datanode::datanode::open_all_regions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TraceRequestSchema · ×1
  • TraceRequestSchema::resolve_table_schema (cognitive 16) src/frontend/src/instance/otlp/trace_ingest.rs:723 — TraceRequestSchema::resolve_table_schema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionSupervisorTicker · ×1
  • RegionSupervisorTicker::start (cognitive 16) src/meta-srv/src/region/supervisor.rs:199 — RegionSupervisorTicker::start has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MetricEngine · ×1
  • MetricEngine::handle_request (cognitive 16) src/metric-engine/src/engine.rs:211 — MetricEngine::handle_request has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MetricEngineInner · ×1
  • MetricEngineInner::verify_rows (cognitive 16) src/metric-engine/src/engine/put.rs:555 — MetricEngineInner::verify_rows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegionFlushTask · ×1
  • RegionFlushTask::do_flush_memtables (cognitive 16) src/mito2/src/flush.rs:604 — RegionFlushTask::do_flush_memtables has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SeriesIndexSearcher · ×1
  • SeriesIndexSearcher::search (cognitive 16) src/mito2/src/series_index/searcher.rs:101 — SeriesIndexSearcher::search has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BloomFilterIndexApplier · ×1
  • BloomFilterIndexApplier::apply (cognitive 16) src/mito2/src/sst/index/bloom_filter/applier.rs:226 — BloomFilterIndexApplier::apply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SingleCreator · ×1
  • SingleCreator::update_flat (cognitive 16) src/mito2/src/sst/index/fulltext_index/creator.rs:432 — SingleCreator::update_flat has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 3, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · QuantileOverTime · ×1
  • QuantileOverTime::quantile_over_time (cognitive 16) src/promql/src/functions/quantile.rs:56 — QuantileOverTime::quantile_over_time has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), match/switch 3 (5 pts), loops 2 (4 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ci_scope.derive_outputs (cognitive 16) · ×1
  • ci_scope.derive_outputs (cognitive 16) .github/ci/ci_scope.py:463 — ci_scope.derive_outputs has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 2 (4 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · metric-snapshot-s3-ops.scrub (cognitive 16) · ×1
  • metric-snapshot-s3-ops.scrub (cognitive 16) .github/scripts/metric-snapshot-s3-ops.py:138 — metric-snapshot-s3-ops.scrub has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · query-regression-nightly-refs.select_base_and_candidate (cognitive 16) · ×1
  • query-regression-nightly-refs.select_base_and_candidate (cognitive 16) .github/scripts/query-regression-nightly-refs.py:122 — query-regression-nightly-refs.select_base_and_candidate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · query-regression-run.run_remote_case (cognitive 16) · ×1
  • query-regression-run.run_remote_case (cognitive 16) .github/scripts/query-regression-run.py:411 — query-regression-run.run_remote_case has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 3, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (4 members, 34 shared lines) · ×1
  • Near-duplicate member family (4 members, 34 shared lines) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:264 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:264-354 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:249-337 | src/meta-srv/src/procedure/repartition/group/remap_manifest.rs:133-206 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:221-296 — These 4 members are variants of one another: a block of 34 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 15 shared lines) · ×1
  • Near-duplicate member family (4 members, 15 shared lines) src/common/function/src/scalars/geo/geohash.rs:89 — src/common/function/src/scalars/geo/geohash.rs:89-130 | src/common/function/src/scalars/geo/geohash.rs:190-250 | src/common/function/src/scalars/geo/h3.rs:97-138 | src/common/function/src/scalars/geo/h3.rs:188-229 — These 4 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 23 shared lines) · ×1
  • Near-duplicate member family (3 members, 23 shared lines) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:135 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:135-256 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:135-231 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:120-212 — These 3 members are variants of one another: a block of 23 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (49 shared lines) · ×1
  • Near-duplicate member pair (49 shared lines) src/flow/src/batching_mode/engine.rs:188 — src/flow/src/batching_mode/engine.rs:188-320 | src/flow/src/batching_mode/engine.rs:325-437 — These two members are variants of one another: 49 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (33 shared lines) · ×1
  • Near-duplicate member pair (33 shared lines) src/mito2/src/engine.rs:996 — src/mito2/src/engine.rs:996-1040 | src/mito2/src/engine.rs:1093-1156 — These two members are variants of one another: 33 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (31 shared lines) · ×1
  • Near-duplicate member pair (31 shared lines) src/mito2/src/sst/index/bloom_filter/creator.rs:282 — src/mito2/src/sst/index/bloom_filter/creator.rs:282-353 | src/mito2/src/sst/index/inverted_index/creator.rs:314-390 — These two members are variants of one another: 31 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (23 shared lines) · ×1
  • Near-duplicate member pair (23 shared lines) src/common/function/src/scalars/ip/cidr.rs:81 — src/common/function/src/scalars/ip/cidr.rs:81-171 | src/common/function/src/scalars/ip/cidr.rs:219-282 — These two members are variants of one another: 23 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (18 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (18 members, 50+ identical tokens) src/pipeline/src/etl/processor/cmcd.rs:214 — src/pipeline/src/etl/processor/cmcd.rs:214-244 | src/pipeline/src/etl/processor/csv.rs:104-184 | src/pipeline/src/etl/processor/date.rs:93-144 | src/pipeline/src/etl/processor/decolorize.rs:69-96 | src/pipeline/src/etl/processor/digest.rs:130-192 | src/pipeline/src/etl/processor/dissect.rs:557-600 | src/pipeline/src/etl/processor/epoch.rs:137-172 | src/pipeline/src/etl/processor/gsub.rs:67-110 | src/pipeline/src/etl/processor/join.rs:54-86 | src/pipeline/src/etl/processor/json_parse.rs:39-67 | src/pipeline/src/etl/processor/json_path.rs:34-81 | src/pipeline/src/etl/processor/letter.rs:85-116 | src/pipeline/src/etl/processor/logfmt.rs:52-78 | src/pipeline/src/etl/processor/regex.rs:90-131 | src/pipeline/src/etl/processor/select.rs:64-90 | src/pipeline/src/etl/processor/simple_extract.rs:42-76 | src/pipeline/src/etl/processor/urlencoding.rs:81-117 | src/pipeline/src/etl/transform.rs:549-645 — These 18 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 18 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 18 times.
D4 · Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (11 members, 50+ identical tokens) src/catalog/src/system_schema/information_schema/cluster_info.rs:163 — src/catalog/src/system_schema/information_schema/cluster_info.rs:163-181 | src/catalog/src/system_schema/information_schema/columns.rs:184-202 | src/catalog/src/system_schema/information_schema/key_column_usage.rs:171-189 | src/catalog/src/system_schema/information_schema/partitions.rs:191-209 | src/catalog/src/system_schema/information_schema/procedure_info.rs:121-139 | src/catalog/src/system_schema/information_schema/recycle_bin.rs:142-160 | src/catalog/src/system_schema/information_schema/region_peers.rs:129-147 | src/catalog/src/system_schema/information_schema/region_statistics.rs:167-187 | src/catalog/src/system_schema/information_schema/schemata.rs:117-135 | src/catalog/src/system_schema/information_schema/statistics.rs:158-176 | src/catalog/src/system_schema/information_schema/table_constraints.rs:126-144 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) src/servers/src/http/prometheus.rs:369 — src/servers/src/http/prometheus.rs:369-426 | src/servers/src/http/prometheus.rs:481-586 | src/servers/src/http/prometheus.rs:623-728 | src/servers/src/http/prometheus.rs:832-956 | src/servers/src/http/prometheus.rs:1858-2029 | src/servers/src/http/prometheus.rs:2527-2663 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Edited copy of a member (148 corresponding lines) · ×1
  • Edited copy of a member (148 corresponding lines) src/servers/src/http/prometheus.rs:1188 — src/servers/src/http/prometheus.rs:1188-1335 | src/servers/src/http/result.rs:105-255 — These two members are one piece of code written twice and then edited apart: 148 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (132 corresponding lines) · ×1
  • Edited copy of a member (132 corresponding lines) src/mito2/src/worker/handle_write.rs:312 — src/mito2/src/worker/handle_write.rs:312-482 | src/mito2/src/worker/handle_write.rs:490-621 — These two members are one piece of code written twice and then edited apart: 132 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) src/datatypes/src/vectors/json/builder.rs:619 — src/datatypes/src/vectors/json/builder.rs:619-678 | src/datatypes/src/vectors/json/builder.rs:808-868 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (56 corresponding lines) · ×1
  • Edited copy of a member (56 corresponding lines) src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:287 — src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:287-342 | src/pipeline/src/etl/transform/transformer/greptime/coerce.rs:344-411 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (80 corresponding lines) · ×1
  • Edited copy of a member (80 corresponding lines) src/common/meta/src/key/flow.rs:244 — src/common/meta/src/key/flow.rs:244-323 | src/common/meta/src/key/flow.rs:332-424 — These two members are one piece of code written twice and then edited apart: 80 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (82 corresponding lines) · ×1
  • Edited copy of a member (82 corresponding lines) src/frontend/src/instance/otlp/trace_ingest.rs:1568 — src/frontend/src/instance/otlp/trace_ingest.rs:1568-1661 | src/frontend/src/instance/otlp/trace_ingest.rs:1668-1749 — These two members are one piece of code written twice and then edited apart: 82 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 40+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 40+ corresponding lines) src/catalog/src/system_schema/information_schema/columns.rs:107 — src/catalog/src/system_schema/information_schema/columns.rs:107-154 | src/catalog/src/system_schema/information_schema/partitions.rs:80-161 | src/catalog/src/system_schema/information_schema/tables.rs:94-133 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 40 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) src/mito2/src/memtable/time_series.rs:1159 — src/mito2/src/memtable/time_series.rs:1159-1209 | src/mito2/src/memtable/time_series.rs:1301-1351 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (69 corresponding lines) · ×1
  • Edited copy of a member (69 corresponding lines) src/flow/src/batching_mode/frontend_client.rs:600 — src/flow/src/batching_mode/frontend_client.rs:600-668 | src/flow/src/batching_mode/frontend_client.rs:677-757 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (55 corresponding lines) · ×1
  • Edited copy of a member (55 corresponding lines) src/common/meta/src/ddl/drop_table/executor.rs:402 — src/common/meta/src/ddl/drop_table/executor.rs:402-460 | src/common/meta/src/ddl/undrop_table.rs:508-562 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (50 corresponding lines) · ×1
  • Edited copy of a member (50 corresponding lines) src/puffin/src/puffin_manager/stager/bounded_stager.rs:150 — src/puffin/src/puffin_manager/stager/bounded_stager.rs:150-199 | src/puffin/src/puffin_manager/stager/bounded_stager.rs:206-263 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 66+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 66+ corresponding lines) src/mito2/src/sst/parquet/reader.rs:1037 — src/mito2/src/sst/parquet/reader.rs:1037-1102 | src/mito2/src/sst/parquet/reader.rs:1212-1294 | src/mito2/src/sst/parquet/reader.rs:1304-1386 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 66 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (59 corresponding lines) · ×1
  • Edited copy of a member (59 corresponding lines) src/query/src/part_sort.rs:1032 — src/query/src/part_sort.rs:1032-1090 | src/query/src/part_sort.rs:1095-1166 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:44 — src/common/meta/src/reconciliation/reconcile_database/reconcile_logical_tables.rs:44-121 | src/common/meta/src/reconciliation/reconcile_database/reconcile_tables.rs:42-95 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 61+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 61+ corresponding lines) src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:91 — src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:91-156 | src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:211-271 | src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs:235-298 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 61 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (63 corresponding lines) · ×1
  • Edited copy of a member (63 corresponding lines) src/cache/src/lib.rs:60 — src/cache/src/lib.rs:60-127 | src/cache/src/lib.rs:136-198 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 30+ corresponding lines) src/common/function/src/scalars/geo/measure.rs:64 — src/common/function/src/scalars/geo/measure.rs:64-93 | src/common/function/src/scalars/ip/range.rs:69-114 | src/common/function/src/scalars/ip/range.rs:157-200 | src/common/function/src/scalars/json/json_path_match.rs:62-100 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 47+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 47+ corresponding lines) src/servers/src/http/jaeger.rs:403 — src/servers/src/http/jaeger.rs:403-449 | src/servers/src/http/jaeger.rs:592-652 | src/servers/src/http/jaeger.rs:667-715 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 47 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×1
  • Edited copy of a member (45 corresponding lines) src/common/grpc-expr/src/alter.rs:65 — src/common/grpc-expr/src/alter.rs:65-109 | src/store-api/src/region_request.rs:1577-1625 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 34+ corresponding lines) src/index/src/fulltext_index/create/bloom_filter.rs:92 — src/index/src/fulltext_index/create/bloom_filter.rs:92-131 | src/mito2/src/sst/index/bloom_filter/creator.rs:479-512 | src/mito2/src/sst/index/inverted_index/creator.rs:410-446 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×1
  • Edited copy of a member (44 corresponding lines) src/datanode/src/heartbeat/handler/enter_staging.rs:57 — src/datanode/src/heartbeat/handler/enter_staging.rs:57-116 | src/datanode/src/heartbeat/handler/sync_region.rs:56-99 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 32+ corresponding lines) src/cli/src/data/export_v2/data.rs:261 — src/cli/src/data/export_v2/data.rs:261-292 | src/cli/src/data/export_v2/data.rs:294-325 | src/cli/src/data/export_v2/data.rs:368-400 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 1+ corresponding lines) src/meta-srv/src/gc/scheduler.rs:116 — src/meta-srv/src/gc/scheduler.rs:116-116 | src/meta-srv/src/procedure/wal_prune/manager.rs:94-94 | src/meta-srv/src/region/flush_trigger.rs:56-56 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 24+ corresponding lines) src/mito2/src/cache/index/bloom_filter_index.rs:124 — src/mito2/src/cache/index/bloom_filter_index.rs:124-150 | src/mito2/src/cache/index/bloom_filter_index.rs:156-181 | src/mito2/src/cache/index/inverted_index.rs:104-129 | src/mito2/src/cache/index/inverted_index.rs:135-158 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) src/mito2/src/sst/index/handler/builtin/bloom.rs:125 — src/mito2/src/sst/index/handler/builtin/bloom.rs:125-147 | src/mito2/src/sst/index/handler/builtin/fulltext.rs:138-168 | src/mito2/src/sst/index/handler/builtin/inverted.rs:186-208 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 29+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 29+ corresponding lines) src/query/src/sql.rs:420 — src/query/src/sql.rs:420-473 | src/query/src/sql.rs:577-615 | src/query/src/sql.rs:702-751 | src/query/src/sql.rs:1144-1172 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 25+ corresponding lines) src/common/function/src/admin/build_index_table.rs:81 — src/common/function/src/admin/build_index_table.rs:81-117 | src/common/function/src/admin/flush_compact_region.rs:37-65 | src/common/function/src/admin/flush_compact_table.rs:54-89 | src/common/function/src/admin/purge_table.rs:41-72 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 14+ corresponding lines) src/common/function/src/scalars/geo/h3.rs:263 — src/common/function/src/scalars/geo/h3.rs:263-277 | src/common/function/src/scalars/geo/h3.rs:425-438 | src/common/function/src/scalars/geo/h3.rs:472-486 | src/common/function/src/scalars/geo/h3.rs:520-534 | src/common/function/src/scalars/geo/s2.rs:151-165 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 39+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 39+ corresponding lines) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:365 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:365-403 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:348-387 | src/meta-srv/src/procedure/repartition/group/sync_region.rs:307-346 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 39 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) src/mito2/src/read/seq_scan.rs:130 — src/mito2/src/read/seq_scan.rs:130-141 | src/mito2/src/read/series_scan.rs:458-477 | src/mito2/src/read/unordered_scan.rs:178-189 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 20+ corresponding lines) src/mito2/src/sst/index/bloom_filter/creator.rs:197 — src/mito2/src/sst/index/bloom_filter/creator.rs:197-217 | src/mito2/src/sst/index/bloom_filter/creator.rs:220-240 | src/mito2/src/sst/index/bloom_filter/creator.rs:249-268 | src/mito2/src/sst/index/fulltext_index/creator.rs:252-271 | src/mito2/src/sst/index/inverted_index/creator.rs:143-163 | src/mito2/src/sst/index/inverted_index/creator.rs:283-302 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 1+ corresponding lines) src/datatypes/src/vectors/boolean.rs:232 — src/datatypes/src/vectors/boolean.rs:232-232 | src/datatypes/src/vectors/decimal.rs:386-386 | src/datatypes/src/vectors/list.rs:156-156 | src/datatypes/src/vectors/null.rs:143-143 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) src/common/meta/src/cache/table/schema.rs:42 — src/common/meta/src/cache/table/schema.rs:42-57 | src/common/meta/src/cache/table/table_info.rs:54-67 | src/common/meta/src/cache/table/table_schema.rs:46-63 | src/common/meta/src/cache/table/view_info.rs:46-59 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 11+ corresponding lines) src/meta-client/src/client/store.rs:148 — src/meta-client/src/client/store.rs:148-158 | src/meta-client/src/client/store.rs:160-172 | src/meta-client/src/client/store.rs:174-185 | src/meta-client/src/client/store.rs:187-199 | src/meta-client/src/client/store.rs:201-213 | src/meta-client/src/client/store.rs:218-233 | src/meta-client/src/client/store.rs:235-247 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 16+ corresponding lines) src/common/meta/src/ddl_manager.rs:1401 — src/common/meta/src/ddl_manager.rs:1401-1416 | src/common/meta/src/ddl_manager.rs:1422-1438 | src/common/meta/src/ddl_manager.rs:1444-1459 | src/common/meta/src/ddl_manager.rs:1491-1507 | src/common/meta/src/ddl_manager.rs:1667-1682 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 12+ corresponding lines) src/common/function/src/scalars/geo/h3.rs:1109 — src/common/function/src/scalars/geo/h3.rs:1109-1129 | src/common/function/src/scalars/geo/h3.rs:1359-1371 | src/common/function/src/scalars/geo/h3.rs:1373-1384 | src/common/function/src/scalars/geo/h3.rs:1386-1397 | src/common/function/src/scalars/geo/s2.rs:50-63 | src/common/function/src/scalars/geo/s2.rs:278-289 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 10+ corresponding lines) src/common/time/src/timestamp.rs:157 — src/common/time/src/timestamp.rs:157-166 | src/common/time/src/timestamp.rs:169-179 | src/common/time/src/timestamp.rs:193-202 | src/common/time/src/timestamp.rs:205-215 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 1+ corresponding lines) src/common/function/src/scalars/vector/distance.rs:44 — src/common/function/src/scalars/vector/distance.rs:44-61 | src/common/function/src/scalars/vector/vector_add.rs:29-29 | src/common/function/src/scalars/vector/vector_div.rs:29-29 | src/common/function/src/scalars/vector/vector_mul.rs:29-29 | src/common/function/src/scalars/vector/vector_sub.rs:29-29 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 9+ corresponding lines) src/common/meta/src/key/flow/flow_info.rs:428 — src/common/meta/src/key/flow/flow_info.rs:428-436 | src/common/meta/src/key/flow/flow_name.rs:240-250 | src/common/meta/src/key/table_info.rs:159-169 | src/common/meta/src/key/table_repart.rs:189-199 | src/common/meta/src/key/table_route.rs:636-646 | src/common/meta/src/key/view_info.rs:160-170 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 7+ corresponding lines) src/common/meta/src/reconciliation/reconcile_catalog.rs:210 — src/common/meta/src/reconciliation/reconcile_catalog.rs:210-216 | src/meta-srv/src/procedure/region_migration.rs:1018-1024 | src/meta-srv/src/procedure/repartition.rs:800-806 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 9+ corresponding lines) src/promql/src/functions/aggr_over_time.rs:175 — src/promql/src/functions/aggr_over_time.rs:175-183 | src/promql/src/functions/double_exponential_smoothing.rs:125-133 | src/promql/src/functions/idelta.rs:41-49 | src/promql/src/functions/round.rs:42-50 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (39–40 lines × 2) · ×1
  • Duplicated block (39–40 lines × 2) src/mito2/src/worker/handle_write.rs:347 — src/mito2/src/worker/handle_write.rs:347-386 | src/mito2/src/worker/handle_write.rs:516-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/worker/handle_write.rs:347` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) src/index/src/bloom_filter/reader.rs:56 — src/index/src/bloom_filter/reader.rs:56-91 | src/index/src/inverted_index/format/reader.rs:50-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (34–35 lines × 2) · ×1
  • Duplicated block (34–35 lines × 2) src/mito2/src/sst/parquet/reader.rs:1038 — src/mito2/src/sst/parquet/reader.rs:1038-1072 | src/mito2/src/sst/parquet/reader.rs:1305-1338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/parquet/reader.rs:1038` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (32–35 lines × 2) · ×1
  • Duplicated block (32–35 lines × 2) src/mito2/src/worker/handle_write.rs:402 — src/mito2/src/worker/handle_write.rs:402-436 | src/mito2/src/worker/handle_write.rs:560-591 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/worker/handle_write.rs:402` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) src/common/function/src/aggrs/geo/encoding.rs:106 — src/common/function/src/aggrs/geo/encoding.rs:106-139 | src/common/function/src/aggrs/geo/geo_path.rs:128-161 — before extracting anything, compare `src/common/function/src/aggrs/geo/encoding.rs` and `src/common/function/src/aggrs/geo/geo_path.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/geo/encoding.rs:106` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) src/servers/src/otlp/logs.rs:670 — src/servers/src/otlp/logs.rs:670-701 | src/servers/src/otlp/logs.rs:793-824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/otlp/logs.rs:670` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) src/flow/src/batching_mode/engine.rs:228 — src/flow/src/batching_mode/engine.rs:228-256 | src/flow/src/batching_mode/engine.rs:371-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/engine.rs:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28 lines × 3) · ×1
  • Duplicated block (28 lines × 3) src/cmd/src/datanode/objbench.rs:260 — src/cmd/src/datanode/objbench.rs:260-287 | src/cmd/src/datanode/parquetbench.rs:449-476 | src/cmd/src/datanode/scanbench.rs:1240-1267 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (27–28 lines × 3) · ×1
  • Duplicated block (27–28 lines × 3) src/promql/src/functions/native_histogram.rs:1119 — src/promql/src/functions/native_histogram.rs:1119-1145 | src/promql/src/functions/native_histogram.rs:1196-1222 | src/promql/src/functions/native_histogram.rs:2749-2776 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (27 lines × 4) · ×1
  • Duplicated block (27 lines × 4) src/common/meta/src/reconciliation/reconcile_catalog.rs:182 — src/common/meta/src/reconciliation/reconcile_catalog.rs:182-208 | src/common/meta/src/reconciliation/reconcile_database.rs:222-248 | src/common/meta/src/reconciliation/reconcile_logical_tables.rs:198-224 | src/common/meta/src/reconciliation/reconcile_table.rs:309-335 — before extracting anything, compare `src/common/meta/src/reconciliation/reconcile_catalog.rs` and `src/common/meta/src/reconciliation/reconcile_database.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) src/common/telemetry/src/metric.rs:119 — src/common/telemetry/src/metric.rs:119-145 | src/common/telemetry/src/metric.rs:159-185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/telemetry/src/metric.rs:119` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) src/promql/src/functions/idelta.rs:71 — src/promql/src/functions/idelta.rs:71-95 | src/promql/src/functions/predict_linear.rs:72-96 | src/promql/src/functions/quantile.rs:70-94 — before extracting anything, compare `src/promql/src/functions/idelta.rs` and `src/promql/src/functions/quantile.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) src/cache/src/lib.rs:75 — src/cache/src/lib.rs:75-96 | src/cache/src/lib.rs:138-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–24 lines × 2) · ×1
  • Duplicated block (20–24 lines × 2) src/operator/src/expr_helper.rs:356 — src/operator/src/expr_helper.rs:356-379 | src/query/src/sql/show_create_table.rs:151-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/expr_helper.rs:356` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) src/query/src/promql/planner.rs:1218 — src/query/src/promql/planner.rs:1218-1240 | src/query/src/promql/planner.rs:1287-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:1218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–22 lines × 4) · ×1
  • Duplicated block (20–22 lines × 4) src/pipeline/src/etl/processor/cmcd.rs:215 — src/pipeline/src/etl/processor/cmcd.rs:215-236 | src/pipeline/src/etl/processor/decolorize.rs:70-90 | src/pipeline/src/etl/processor/json_parse.rs:40-59 | src/pipeline/src/etl/processor/logfmt.rs:53-72 — before extracting anything, compare `src/pipeline/src/etl/processor/decolorize.rs` and `src/pipeline/src/etl/processor/logfmt.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) src/mito2/src/sst/index/bloom_filter/applier.rs:70 — src/mito2/src/sst/index/bloom_filter/applier.rs:70-89 | src/mito2/src/sst/index/inverted_index/applier.rs:69-90 — `src/mito2/src/sst/index/bloom_filter/applier.rs` and `src/mito2/src/sst/index/inverted_index/applier.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 71 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/inverted_index/applier.rs:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20–21 lines × 5) · ×1
  • Duplicated block (20–21 lines × 5) src/pipeline/src/etl/processor/dissect.rs:623 — src/pipeline/src/etl/processor/dissect.rs:623-642 | src/pipeline/src/etl/processor/join.rs:108-128 | src/pipeline/src/etl/processor/letter.rs:138-158 | src/pipeline/src/etl/processor/regex.rs:210-230 | src/pipeline/src/etl/processor/urlencoding.rs:139-158 — before extracting anything, compare `src/pipeline/src/etl/processor/dissect.rs` and `src/pipeline/src/etl/processor/letter.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/dissect.rs:623` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) src/servers/src/otlp/metrics.rs:1277 — src/servers/src/otlp/metrics.rs:1277-1294 | src/servers/src/otlp/metrics.rs:1302-1322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/otlp/metrics.rs:1277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/servers/src/otlp/metrics.rs:1275` calls `Some` and `src/servers/src/otlp/metrics.rs:1299` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–19 lines × 2) · ×1
  • Duplicated block (16–19 lines × 2) src/servers/src/otlp/metrics.rs:1427 — src/servers/src/otlp/metrics.rs:1427-1445 | src/servers/src/otlp/metrics.rs:1453-1468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/otlp/metrics.rs:1427` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) src/common/function/src/aggrs/geo/encoding.rs:180 — src/common/function/src/aggrs/geo/encoding.rs:180-214 | src/common/function/src/aggrs/geo/geo_path.rs:209-243 — before extracting anything, compare `src/common/function/src/aggrs/geo/encoding.rs` and `src/common/function/src/aggrs/geo/geo_path.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 129 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) src/flow/src/batching_mode/task.rs:818 — src/flow/src/batching_mode/task.rs:818-833 | src/flow/src/batching_mode/task.rs:1278-1295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/flow/src/batching_mode/task.rs:818` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–18 lines × 2) · ×1
  • Duplicated block (13–18 lines × 2) src/servers/src/grpc/flight/stream.rs:322 — src/servers/src/grpc/flight/stream.rs:322-339 | src/servers/src/grpc/flight/stream.rs:340-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/grpc/flight/stream.rs:322` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–17 lines × 5) · ×1
  • Duplicated block (16–17 lines × 5) src/servers/src/postgres/types.rs:649 — src/servers/src/postgres/types.rs:649-664 | src/servers/src/postgres/types.rs:693-708 | src/servers/src/postgres/types.rs:740-755 | src/servers/src/postgres/types.rs:808-824 | src/servers/src/postgres/types.rs:859-875 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:808` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/servers/src/postgres/types.rs:691` calls `Int32`, `Int64`, `UInt8` and `src/servers/src/postgres/types.rs:808` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) src/mito2/src/sst/index/bloom_filter/applier.rs:71 — src/mito2/src/sst/index/bloom_filter/applier.rs:71-87 | src/mito2/src/sst/index/fulltext_index/applier.rs:81-97 | src/mito2/src/sst/index/inverted_index/applier.rs:70-86 — `src/mito2/src/sst/index/bloom_filter/applier.rs` and `src/mito2/src/sst/index/fulltext_index/applier.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 40 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/bloom_filter/applier.rs:71` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (15–16 lines × 4) · ×1
  • Duplicated block (15–16 lines × 4) src/servers/src/otlp/metrics.rs:1276 — src/servers/src/otlp/metrics.rs:1276-1290 | src/servers/src/otlp/metrics.rs:1301-1315 | src/servers/src/otlp/metrics.rs:1427-1441 | src/servers/src/otlp/metrics.rs:1453-1468 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/servers/src/otlp/metrics.rs:1275` calls `Some` and `src/servers/src/otlp/metrics.rs:1299` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) src/catalog/src/system_schema/information_schema/information_memory_table.rs:111 — src/catalog/src/system_schema/information_schema/information_memory_table.rs:111-126 | src/catalog/src/system_schema/information_schema/information_memory_table.rs:130-141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/information_memory_table.rs:111` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) src/operator/src/statement/ddl.rs:2554 — src/operator/src/statement/ddl.rs:2554-2567 | src/operator/src/statement/ddl.rs:2834-2849 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/operator/src/statement/ddl.rs:2554` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `partitions` to `&Partitions` in one and `&Option<Partitions>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:278 — src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:278-292 | src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs:263-276 | src/meta-srv/src/procedure/repartition/group/remap_manifest.rs:144-157 — before extracting anything, compare `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs` and `src/meta-srv/src/procedure/repartition/group/enter_staging_region.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 135 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/repartition/group/apply_staging_manifest.rs:278` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) src/mito2/src/sst/index/fulltext_index/applier/builder.rs:211 — src/mito2/src/sst/index/fulltext_index/applier/builder.rs:211-222 | src/mito2/src/sst/index/fulltext_index/applier/builder.rs:240-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/sst/index/fulltext_index/applier/builder.rs:211` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–13 lines × 18) · ×1
  • Duplicated block (11–13 lines × 18) src/pipeline/src/etl/processor/cmcd.rs:219 — src/pipeline/src/etl/processor/cmcd.rs:219-230 | src/pipeline/src/etl/processor/csv.rs:114-124 | src/pipeline/src/etl/processor/date.rs:101-113 | src/pipeline/src/etl/processor/decolorize.rs:74-85 | src/pipeline/src/etl/processor/digest.rs:136-147 | src/pipeline/src/etl/processor/dissect.rs:564-575 | src/pipeline/src/etl/processor/epoch.rs:143-154 | src/pipeline/src/etl/processor/gsub.rs:74-85 | src/pipeline/src/etl/processor/join.rs:60-71 | src/pipeline/src/etl/processor/json_parse.rs:44-54 | src/pipeline/src/etl/processor/json_path.rs:41-52 | src/pipeline/src/etl/processor/letter.rs:91-101 | src/pipeline/src/etl/processor/logfmt.rs:57-67 | src/pipeline/src/etl/processor/regex.rs:96-106 | src/pipeline/src/etl/processor/select.rs:69-79 | src/pipeline/src/etl/processor/simple_extract.rs:48-58 | src/pipeline/src/etl/processor/urlencoding.rs:87-98 | src/pipeline/src/etl/transform.rs:560-572 — before extracting anything, compare `src/pipeline/src/etl/processor/decolorize.rs` and `src/pipeline/src/etl/processor/digest.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/cmcd.rs:219` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/pipeline/src/etl/processor/join.rs:72` calls `Some`, `yaml_string` and `src/pipeline/src/etl/processor/cmcd.rs:231` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–13 lines × 2) · ×1
  • Duplicated block (8–13 lines × 2) src/catalog/src/system_schema/information_schema/region_peers.rs:224 — src/catalog/src/system_schema/information_schema/region_peers.rs:224-231 | src/catalog/src/system_schema/information_schema/tables.rs:301-313 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/tables.rs:301` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) src/frontend/src/instance.rs:312 — src/frontend/src/instance.rs:312-324 | src/frontend/src/instance.rs:642-650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance.rs:312` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/frontend/src/instance.rs:308` calls `is_explain_analyze_verbose`, `then`, `as_ref` and `src/frontend/src/instance.rs:641` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×1
  • Duplicated block (9–12 lines × 2) src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:101 — src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:101-112 | src/meta-srv/src/procedure/utils.rs:155-163 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 11) · ×1
  • Duplicated block (11 lines × 11) src/catalog/src/system_schema/information_schema/cluster_info.rs:171 — src/catalog/src/system_schema/information_schema/cluster_info.rs:171-181 | src/catalog/src/system_schema/information_schema/columns.rs:192-202 | src/catalog/src/system_schema/information_schema/key_column_usage.rs:179-189 | src/catalog/src/system_schema/information_schema/partitions.rs:199-209 | src/catalog/src/system_schema/information_schema/procedure_info.rs:129-139 | src/catalog/src/system_schema/information_schema/recycle_bin.rs:150-160 | src/catalog/src/system_schema/information_schema/region_peers.rs:137-147 | src/catalog/src/system_schema/information_schema/region_statistics.rs:176-187 | src/catalog/src/system_schema/information_schema/schemata.rs:125-135 | src/catalog/src/system_schema/information_schema/statistics.rs:166-176 | src/catalog/src/system_schema/information_schema/table_constraints.rs:134-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 11 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/cluster_info.rs:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) src/common/meta/src/key/schema_name.rs:283 — src/common/meta/src/key/schema_name.rs:283-293 | src/common/meta/src/key/table_info.rs:183-193 | src/common/meta/src/key/table_repart.rs:214-224 | src/common/meta/src/key/table_route.rs:662-672 | src/common/meta/src/key/view_info.rs:184-194 — before extracting anything, compare `src/common/meta/src/key/table_info.rs` and `src/common/meta/src/key/view_info.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key/table_info.rs:183` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–11 lines × 3) · ×1
  • Duplicated block (8–11 lines × 3) src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:100 — src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:100-110 | src/meta-srv/src/procedure/region_migration/open_candidate_region.rs:163-172 | src/meta-srv/src/procedure/utils.rs:154-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/meta-srv/src/procedure/region_migration/close_downgraded_region.rs:100` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) src/common/function/src/aggrs/vector/avg.rs:89 — src/common/function/src/aggrs/vector/avg.rs:89-114 | src/common/function/src/aggrs/vector/product.rs:109-134 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/aggrs/vector/avg.rs:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) src/servers/src/http/prometheus.rs:370 — src/servers/src/http/prometheus.rs:370-379 | src/servers/src/http/prometheus.rs:500-509 | src/servers/src/http/prometheus.rs:637-646 | src/servers/src/http/prometheus.rs:833-842 | src/servers/src/http/prometheus.rs:1859-1868 | src/servers/src/http/prometheus.rs:2552-2561 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/servers/src/http/prometheus.rs:831` calls `Form` and `src/servers/src/http/prometheus.rs:368` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) src/servers/src/postgres/types.rs:682 — src/servers/src/postgres/types.rs:682-690 | src/servers/src/postgres/types.rs:726-735 | src/servers/src/postgres/types.rs:792-801 | src/servers/src/postgres/types.rs:843-852 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:682` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×1
  • Duplicated block (7–10 lines × 2) src/mito2/src/series_index/writer.rs:297 — src/mito2/src/series_index/writer.rs:297-306 | src/mito2/src/sst/range_index/writer.rs:320-326 — before extracting anything, compare `src/mito2/src/series_index/writer.rs` and `src/mito2/src/sst/range_index/writer.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/mito2/src/series_index/writer.rs:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) src/catalog/src/system_schema/information_schema/flow_statistics.rs:140 — src/catalog/src/system_schema/information_schema/flow_statistics.rs:140-148 | src/catalog/src/system_schema/information_schema/flows.rs:227-235 | src/catalog/src/system_schema/information_schema/table_semantics.rs:269-277 | src/catalog/src/system_schema/information_schema/tables.rs:173-181 | src/catalog/src/system_schema/information_schema/views.rs:136-144 — before extracting anything, compare `src/catalog/src/system_schema/information_schema/flow_statistics.rs` and `src/catalog/src/system_schema/information_schema/flows.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/catalog/src/system_schema/information_schema/flow_statistics.rs:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–18 lines × 3) · ×1
  • Duplicated block (12–18 lines × 3) src/common/function/src/scalars/ip/range.rs:74 — src/common/function/src/scalars/ip/range.rs:74-91 | src/common/function/src/scalars/ip/range.rs:162-177 | src/common/function/src/scalars/json/json_path_match.rs:66-77 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/ip/range.rs:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–9 lines × 4) · ×1
  • Duplicated block (4–9 lines × 4) src/common/function/src/scalars/geo/measure.rs:68 — src/common/function/src/scalars/geo/measure.rs:68-76 | src/common/function/src/scalars/geo/measure.rs:131-139 | src/common/function/src/scalars/ip/range.rs:70-73 | src/common/function/src/scalars/ip/range.rs:158-161 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/measure.rs:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/common/function/src/scalars/geo/measure.rs:67` calls `cast`, `as_string_view` and `src/common/function/src/scalars/ip/range.rs:70` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) src/common/query/src/native_histogram.rs:1117 — src/common/query/src/native_histogram.rs:1117-1122 | src/servers/src/otlp/metrics.rs:833-841 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/query/src/native_histogram.rs:1117` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–9 lines × 3) · ×1
  • Duplicated block (4–9 lines × 3) src/api/src/helper.rs:1102 — src/api/src/helper.rs:1102-1105 | src/frontend/src/instance/influxdb.rs:196-204 | src/servers/src/otlp/logs.rs:979-987 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/frontend/src/instance/influxdb.rs:196` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `Value` in one and `&ValueData` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8 lines × 8) · ×1
  • Duplicated block (8 lines × 8) src/table/src/metadata.rs:595 — src/table/src/metadata.rs:595-602 | src/table/src/metadata.rs:655-662 | src/table/src/metadata.rs:912-919 | src/table/src/metadata.rs:1000-1007 | src/table/src/metadata.rs:1187-1194 | src/table/src/metadata.rs:1262-1269 | src/table/src/metadata.rs:1374-1381 | src/table/src/metadata.rs:1417-1424 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/table/src/metadata.rs:595` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 5) · ×1
  • Duplicated block (6–7 lines × 5) src/servers/src/postgres/types.rs:640 — src/servers/src/postgres/types.rs:640-645 | src/servers/src/postgres/types.rs:681-687 | src/servers/src/postgres/types.rs:725-731 | src/servers/src/postgres/types.rs:791-797 | src/servers/src/postgres/types.rs:842-848 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/servers/src/postgres/types.rs:640` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5–7 lines × 3) · ×1
  • Duplicated block (5–7 lines × 3) src/query/src/promql/planner.rs:1745 — src/query/src/promql/planner.rs:1745-1749 | src/query/src/promql/planner.rs:6295-6301 | src/query/src/promql/planner.rs:6589-6594 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/query/src/promql/planner.rs:1745` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/query/src/promql/planner.rs:1744` calls `filter`, `contains`, `name` and `src/query/src/promql/planner.rs:6294` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5–7 lines × 2) · ×1
  • Duplicated block (5–7 lines × 2) src/cmd/src/bin/query_regression_runner/sql.rs:87 — src/cmd/src/bin/query_regression_runner/sql.rs:87-93 | src/cmd/src/bin/query_regression_runner/sql.rs:243-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) src/query/src/promql/planner.rs:4090 — src/query/src/promql/planner.rs:4090-4096 | src/query/src/promql/planner.rs:4100-4105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) REDACTED:850 — REDACTED:850-855 | REDACTED:869-872 | REDACTED:882-887 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:850` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) src/pipeline/src/etl/processor/csv.rs:197 — src/pipeline/src/etl/processor/csv.rs:197-203 | src/pipeline/src/etl/processor/date.rs:197-203 | src/pipeline/src/etl/processor/dissect.rs:613-617 | src/pipeline/src/etl/processor/letter.rs:129-133 | src/pipeline/src/etl/processor/urlencoding.rs:130-134 — before extracting anything, compare `src/pipeline/src/etl/processor/dissect.rs` and `src/pipeline/src/etl/processor/letter.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/pipeline/src/etl/processor/csv.rs:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) src/query/src/optimizer/string_normalization.rs:53 — src/query/src/optimizer/string_normalization.rs:53-58 | src/query/src/optimizer/type_conversion.rs:85-90 | src/query/src/optimizer/type_conversion.rs:103-108 | src/query/src/optimizer/type_conversion.rs:119-124 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (3–5 lines × 4) · ×1
  • Duplicated block (3–5 lines × 4) src/common/function/src/scalars/geo/measure.rs:77 — src/common/function/src/scalars/geo/measure.rs:77-81 | src/common/function/src/scalars/geo/measure.rs:140-144 | src/common/function/src/scalars/geo/s2.rs:95-98 | src/common/function/src/scalars/json/json_path_exists.rs:78-80 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/function/src/scalars/geo/measure.rs:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–5 lines × 6) · ×1
  • Duplicated block (3–5 lines × 6) src/common/function/src/scalars/geo/geohash.rs:92 — src/common/function/src/scalars/geo/geohash.rs:92-94 | src/common/function/src/scalars/geo/geohash.rs:193-195 | src/common/function/src/scalars/geo/h3.rs:100-102 | src/common/function/src/scalars/geo/h3.rs:191-193 | src/common/function/src/scalars/geo/s2.rs:86-90 | src/common/function/src/scalars/geo/wkt.rs:78-82 — before extracting anything, compare `src/common/function/src/scalars/geo/geohash.rs` and `src/common/function/src/scalars/geo/h3.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) src/common/recordbatch/src/filter/timestamp.rs:29 — src/common/recordbatch/src/filter/timestamp.rs:29-33 | src/mito2/src/compaction/reader.rs:270-272 | src/query/src/promql/label_values.rs:69-73 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/recordbatch/src/filter/timestamp.rs:29` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) src/common/meta/src/ddl/event/database.rs:215 — src/common/meta/src/ddl/event/database.rs:215-220 | src/common/meta/src/ddl/event/flow.rs:156-161 | src/common/meta/src/ddl/event/view.rs:210-215 | src/common/meta/src/reconciliation/event.rs:212-217 | src/common/meta/src/reconciliation/event.rs:328-333 | src/common/meta/src/reconciliation/event.rs:442-447 | src/common/meta/src/reconciliation/event.rs:555-560 — there are 7 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7 lines × 8) · ×1
  • Duplicated block (7 lines × 8) src/common/meta/src/key.rs:806 — src/common/meta/src/key.rs:806-812 | src/common/meta/src/key.rs:888-894 | src/common/meta/src/key.rs:1534-1540 | src/common/meta/src/key.rs:1580-1586 | src/common/meta/src/key.rs:1631-1637 | src/common/meta/src/key.rs:1748-1754 | src/common/meta/src/key.rs:1800-1806 | src/common/meta/src/key/schema_name.rs:306-313 — there are 8 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/key.rs:806` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (2–5 lines × 4) · ×1
  • Duplicated block (2–5 lines × 4) src/cmd/src/bin/query_regression_runner/direct.rs:382 — src/cmd/src/bin/query_regression_runner/direct.rs:382-386 | src/cmd/src/bin/query_regression_runner/remote/ingest.rs:282-284 | src/cmd/src/bin/query_regression_runner/remote/read_bench.rs:283-284 | src/cmd/src/bin/query_regression_runner/remote/storage.rs:51-55 — before extracting anything, compare `src/cmd/src/bin/query_regression_runner/remote/ingest.rs` and `src/cmd/src/bin/query_regression_runner/remote/storage.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `src/cmd/src/bin/query_regression_runner/direct.rs:382` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/cmd/src/bin/query_regression_runner/direct.rs:386` calls `elapsed`, `as_secs_f64` and `src/cmd/src/bin/query_regression_runner/remote/read_bench.rs:284` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–23 lines × 3) · ×1
  • Duplicated block (9–23 lines × 3) .github/scripts/query-regression-run.py:332 — .github/scripts/query-regression-run.py:332-340 | .github/scripts/query-regression-run.py:420-442 | .github/scripts/query-regression-run.py:516-524 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `.github/scripts/query-regression-run.py:515` calls `ValueError` and `.github/scripts/query-regression-run.py:331` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 22+ corresponding lines) tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:85 — tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:85-107 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:79-100 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:94-121 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 11+ corresponding lines) tests-fuzz/targets/ddl/fuzz_repartition_table.rs:76 — tests-fuzz/targets/ddl/fuzz_repartition_table.rs:76-94 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:79-89 | tests-fuzz/targets/fuzz_insert.rs:68-82 | tests-fuzz/targets/fuzz_insert_logical_table.rs:69-79 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:77-88 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:229 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:229-259 | tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:297-327 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (52–53 lines × 2) · ×1
  • Duplicated block (52–53 lines × 2) tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:190 — tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:190-241 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:332-384 — before extracting anything, compare `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` and `tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:190` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (36–39 lines × 2) · ×1
  • Duplicated block (36–39 lines × 2) tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:317 — tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:317-355 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:313-348 — before extracting anything, compare `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 110 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:317` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:133 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:133-154 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:95-115 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:440 — tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:440-456 | tests-fuzz/targets/ddl/fuzz_repartition_table.rs:395-414 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs` and `tests-fuzz/targets/ddl/fuzz_repartition_table.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:440` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) tests-fuzz/targets/fuzz_insert.rs:142 — tests-fuzz/targets/fuzz_insert.rs:142-160 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:158-174 — before extracting anything, compare `tests-fuzz/targets/fuzz_insert.rs` and `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/fuzz_insert.rs:142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 4) · ×1
  • Duplicated block (15 lines × 4) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:102 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:102-116 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:126-140 | tests-fuzz/targets/fuzz_insert_logical_table.rs:104-118 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:125-139 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) src/common/meta/src/kv_backend/test.rs:599 — src/common/meta/src/kv_backend/test.rs:599-616 | src/common/meta/src/kv_backend/test.rs:639-656 | src/common/meta/src/kv_backend/test.rs:679-696 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/kv_backend/test.rs:599` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–14 lines × 3) · ×1
  • Duplicated block (10–14 lines × 3) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:226 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:226-238 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:175-188 | tests-fuzz/targets/ddl/fuzz_create_table.rs:112-121 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:226` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 5) · ×1
  • Duplicated block (12–13 lines × 5) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:102 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:102-113 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:116-128 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:126-137 | tests-fuzz/targets/fuzz_insert_logical_table.rs:104-115 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:125-136 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10–13 lines × 4) · ×1
  • Duplicated block (10–13 lines × 4) tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:206 — tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:206-218 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:229-238 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:348-360 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:372-381 — before extracting anything, compare `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs` and `tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:199 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:199-211 | tests-fuzz/targets/fuzz_insert_logical_table.rs:246-258 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:206-216 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tests-fuzz/targets/fuzz_insert_logical_table.rs:260` calls `validate_values`, `clone`, `insert` and `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:213` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–12 lines × 3) · ×1
  • Duplicated block (8–12 lines × 3) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:283 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:283-294 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:417-428 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:375-382 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs` as WHOLE FILES: this scan already matched 22 separate duplicated blocks between them, totalling at least 230 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:283` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) tests-fuzz/targets/ddl/fuzz_alter_table.rs:83 — tests-fuzz/targets/ddl/fuzz_alter_table.rs:83-91 | tests-fuzz/targets/ddl/fuzz_create_table.rs:72-81 | tests-fuzz/targets/fuzz_insert.rs:89-98 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_table.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 30 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–9 lines × 6) · ×1
  • Duplicated block (6–9 lines × 6) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:274 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:274-279 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:282-290 | tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs:339-344 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:408-413 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:416-424 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:374-379 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/failover/fuzz_failover_mito_regions.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–9 lines × 4) · ×1
  • Duplicated block (8–9 lines × 4) tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:178 — tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:178-186 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:199-206 | tests-fuzz/targets/fuzz_insert_logical_table.rs:246-253 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:206-213 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_repartition_metric_table.rs:178` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (2–9 lines × 4) · ×1
  • Duplicated block (2–9 lines × 4) src/common/meta/src/kv_backend/test.rs:559 — src/common/meta/src/kv_backend/test.rs:559-560 | src/common/meta/src/kv_backend/test.rs:589-597 | src/common/meta/src/kv_backend/test.rs:628-630 | src/common/meta/src/kv_backend/test.rs:669-677 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/common/meta/src/kv_backend/test.rs:559` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/common/meta/src/kv_backend/test.rs:589` calls `txn`, `clone`, `unwrap` and `src/common/meta/src/kv_backend/test.rs:559` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:165 — tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:165-172 | tests-fuzz/targets/fuzz_insert.rs:140-147 | tests-fuzz/targets/fuzz_insert_logical_table.rs:209-216 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:164-171 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:286-293 — before extracting anything, compare `tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs` and `tests-fuzz/targets/fuzz_insert_logical_table.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `ctx` to `FuzzContext` in one and `&FuzzContext` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (3–8 lines × 5) · ×1
  • Duplicated block (3–8 lines × 5) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:190 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:190-197 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:268-275 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:142-145 | tests-fuzz/targets/ddl/fuzz_create_table.rs:105-107 | tests-fuzz/targets/unstable/fuzz_create_table_standalone.rs:212-214 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_alter_table.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tests-fuzz/targets/ddl/fuzz_alter_table.rs:268` calls `fetch_columns` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:142` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5–8 lines × 2) · ×1
  • Duplicated block (5–8 lines × 2) tests-fuzz/targets/ddl/fuzz_create_table.rs:96 — tests-fuzz/targets/ddl/fuzz_create_table.rs:96-103 | tests-fuzz/targets/ddl/fuzz_repartition_table.rs:253-257 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6 lines × 11) · ×1
  • Duplicated block (6 lines × 11) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:124 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:124-129 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:230-235 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:86-91 | tests-fuzz/targets/ddl/fuzz_create_table.rs:94-99 | tests-fuzz/targets/ddl/fuzz_repartition_table.rs:251-256 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:111-116 | tests-fuzz/targets/fuzz_insert.rs:131-136 | tests-fuzz/targets/fuzz_insert_logical_table.rs:142-147 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:110-115 | tests-fuzz/targets/migration/fuzz_migrate_mito_regions.rs:300-305 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:256-261 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_alter_table.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:156 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:156-161 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:130-135 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:203-208 | tests-fuzz/targets/fuzz_insert_logical_table.rs:250-255 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:210-215 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) tests-fuzz/targets/ddl/fuzz_create_table.rs:112 — tests-fuzz/targets/ddl/fuzz_create_table.rs:112-116 | tests-fuzz/targets/fuzz_insert.rs:204-209 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/fuzz_insert.rs:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 14) · ×1
  • Duplicated block (5 lines × 14) tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:125 — tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:125-129 | tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:156-160 | tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:180-184 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:231-235 | tests-fuzz/targets/ddl/fuzz_alter_table.rs:250-254 | tests-fuzz/targets/ddl/fuzz_create_database.rs:76-80 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:87-91 | tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:130-134 | tests-fuzz/targets/ddl/fuzz_create_table.rs:95-99 | tests-fuzz/targets/ddl/fuzz_repartition_table.rs:252-256 | tests-fuzz/targets/failover/fuzz_failover_metric_regions.rs:112-116 | tests-fuzz/targets/fuzz_insert_logical_table.rs:143-147 | tests-fuzz/targets/migration/fuzz_migrate_metric_regions.rs:111-115 | tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:257-262 — before extracting anything, compare `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs` and `tests-fuzz/targets/ddl/fuzz_alter_table.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tests-fuzz/targets/wal/fuzz_remote_wal_logical_prune.rs:257` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tests-fuzz/targets/ddl/fuzz_alter_logical_table.rs:187` calls `unwrap_or_clone`, `alter`, `unwrap` and `tests-fuzz/targets/ddl/fuzz_create_logical_table.rs:138` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D5 · Coupling · Unstable project cli · ×1
  • Unstable project cli — cli has instability 0.93 with 2 dependents.
D5 · Coupling · Unstable project common-grpc-expr · ×1
  • Unstable project common-grpc-expr — common-grpc-expr has instability 0.83 with 2 dependents.
D5 · Coupling · Unstable project datanode · ×1
  • Unstable project datanode — datanode has instability 0.93 with 3 dependents.
D5 · Coupling · Unstable project flow · ×1
  • Unstable project flow — flow has instability 0.90 with 3 dependents.
D5 · Coupling · Unstable project frontend · ×1
  • Unstable project frontend — frontend has instability 0.93 with 3 dependents.
D5 · Coupling · Unstable project index · ×1
  • Unstable project index — index has instability 0.89 with 1 dependents.
D5 · Coupling · Unstable project meta-srv · ×1
  • Unstable project meta-srv — meta-srv has instability 0.89 with 3 dependents.
D5 · Coupling · Unstable project metric-engine · ×1
  • Unstable project metric-engine — metric-engine has instability 0.88 with 2 dependents.
D5 · Coupling · Unstable project mito2 · ×1
  • Unstable project mito2 — mito2 has instability 0.87 with 4 dependents.
D5 · Coupling · Unstable project operator · ×1
  • Unstable project operator — operator has instability 0.87 with 5 dependents.
D5 · Coupling · Unstable project pipeline · ×1
  • Unstable project pipeline — pipeline has instability 0.85 with 3 dependents.
D5 · Coupling · Unstable project plugins · ×1
  • Unstable project plugins — plugins has instability 0.93 with 1 dependents.
D5 · Coupling · Unstable project relational-engine · ×1
  • Unstable project relational-engine — relational-engine has instability 0.89 with 1 dependents.
D5 · Coupling · Unstable project servers · ×1
  • Unstable project servers — servers has instability 0.84 with 7 dependents.
D5 · Coupling · Unstable project standalone · ×1
  • Unstable project standalone — standalone has instability 0.91 with 3 dependents.
Minor — 243 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×96
  • Orphaned file src/datatypes/src/vectors/decimal.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/sql/src/statements/transform/expand_interval.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/inverted_index/search/index_apply/predicates_apply.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/decimal/src/decimal128.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/pipeline/src/etl/processor/digest.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/inverted_index/search/fst_apply/intersection_apply.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/partition/src/subtask.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/partition/src/overlap.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/puffin/src/blob_metadata.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/inverted_index/search/fst_apply/keys_apply.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/macro/src/stack_trace_debug.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/function/src/aggrs/approximate/hll.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/meta/src/kv_backend/read_only.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/inverted_index/format/writer/blob.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/stat/src/cgroups.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/mito2/src/schedule/scheduler.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/datatypes/src/types/cast.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/inverted_index/format/reader/blob.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/base/src/range_read.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/catalog/src/system_schema/information_schema/procedure_info.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/meta/src/kv_backend/chroot.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/bloom_filter/creator/intermediate_codec.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/index/src/inverted_index/format/writer/single.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/runtime/src/runtime_throttleable.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file src/common/time/src/util.rs:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 71 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py:192 — `instances and instances[0].status == wanted` appears character-identically in 2 files — .github/runner-scale-sets/query-regression/ecs-image/build-ecs-image.py, .github/scripts/aliyun-ecs-runner-provision.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate .github/scripts/agent-observability-summary.py:76 — `isinstance(v, (int, float)) and math.isfinite(v)` appears character-identically in 2 files — .github/scripts/agent-observability-summary.py, .github/scripts/tracesbench-summary.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate .github/scripts/benchmark-version-comparison.py:50 — `isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) and value >= 0` appears character-identically in 2 files — .github/scripts/benchmark-version-comparison.py, .github/scripts/benchmark_resource_summary.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate .github/scripts/aliyun-ecs-runner-provision.py:253 — `not access_key_id or not access_key_secret` appears character-identically in 2 files — .github/scripts/aliyun-ecs-runner-provision.py, .github/scripts/aliyun-ecs-runner-teardown.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate .github/scripts/agent-observability-summary.py:27 — `not isinstance(ms, (int, float)) or not math.isfinite(ms) or ms < 0` appears character-identically in 2 files — .github/scripts/agent-observability-summary.py, .github/scripts/tracesbench-summary.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate .github/ci/ci_scope.py:613 — `os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN") or ""` appears character-identically in 2 files — .github/ci/ci_scope.py, .github/scripts/query-regression-slash.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/mito2/src/engine.rs:838 — `!edit.files_to_add.is_empty() || !edit.files_to_remove.is_empty()` appears character-identically in 2 files — src/mito2/src/engine.rs, src/mito2/src/region/version.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/datanode/src/greptimedb_telemetry.rs:59 — `!enable || cfg!(test) || cfg!(debug_assertions)` appears character-identically in 2 files — src/datanode/src/greptimedb_telemetry.rs, src/meta-srv/src/greptimedb_telemetry.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/common/meta/src/ddl/drop_flow.rs:88 — `!exists && self.data.task.drop_if_exists` appears character-identically in 2 files — src/common/meta/src/ddl/drop_flow.rs, src/common/meta/src/ddl/drop_view.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/mito2/src/compaction/scheduler/planning.rs:156 — `!output.outputs.is_empty() || !output.expired_ssts.is_empty()` appears character-identically in 2 files — src/mito2/src/compaction/scheduler/planning.rs, src/mito2/src/compaction/twcs.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/common/meta/src/kv_backend/etcd.rs:500 — `!tls_config.cert_path.is_empty() && !tls_config.key_path.is_empty()` appears character-identically in 3 files — src/common/meta/src/kv_backend/etcd.rs, src/common/meta/src/kv_backend/rds/postgres.rs, src/meta-srv/src/utils/mysql.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/common/function/src/scalars/vector/impl_conv.rs:71 — `!trimmed.starts_with('[') || !trimmed.ends_with(']')` appears character-identically in 2 files — src/common/function/src/scalars/vector/impl_conv.rs, src/datatypes/src/types/vector_type.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/mito2/src/sst/index/indexer/abort.rs:25 — `active.is_builtin() && cfg!(any(test, feature = "test"))` appears character-identically in 2 files — src/mito2/src/sst/index/indexer/abort.rs, src/mito2/src/sst/index/indexer/finish.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/promql/src/functions/changes.rs:56 — `current != previous && !(current.is_nan() && previous.is_nan())` appears character-identically in 2 files — src/promql/src/functions/changes.rs, src/promql/src/functions/native_histogram.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/common/function/src/scalars/anomaly/iqr.rs:127 — `current_idx >= array.len() || !array.is_valid(current_idx) || !array.value(current_idx).is_finite()` appears character-identically in 3 files — src/common/function/src/scalars/anomaly/iqr.rs, src/common/function/src/scalars/anomaly/mad.rs, src/common/function/src/scalars/anomaly/zscore.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/mito2/src/series_index/writer.rs:301 — `end < primary_keys.len() && primary_keys.value(end) == primary_key` appears character-identically in 2 files — src/mito2/src/series_index/writer.rs, src/mito2/src/sst/range_index/writer.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs:356 — `err.is_retryable() && retry < self.optimistic_retry` appears character-identically in 2 files — src/meta-srv/src/procedure/region_migration/downgrade_leader_region.rs, src/meta-srv/src/procedure/region_migration/upgrade_candidate_region.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/servers/src/http/prometheus.rs:808 — `err.status_code() == StatusCode::TableNotFound || err.status_code() == StatusCode::TableColumnNotFound` appears character-identically in 2 files — src/servers/src/http/prometheus.rs, src/servers/src/http/result/prometheus_resp.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/mito2/src/read/seq_scan.rs:91 — `input.append_mode && input.total_rows_is_exact()` appears character-identically in 3 files — src/mito2/src/read/seq_scan.rs, src/mito2/src/read/series_scan.rs, src/mito2/src/read/unordered_scan.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/mito2/src/manifest/manager.rs:901 — `is_delta_file(file_name) || is_checkpoint_file(file_name)` appears character-identically in 3 files — src/mito2/src/manifest/manager.rs, src/mito2/src/manifest/storage.rs, src/mito2/src/test_util.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/servers/src/hint_headers.rs:64 — `key.eq_ignore_ascii_case("query_parallelism") && value == "0"` appears character-identically in 2 files — src/servers/src/hint_headers.rs, src/session/src/context.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/servers/src/hint_headers.rs:32 — `key_lower.starts_with("query.") || key_lower.starts_with("datafusion.")` appears character-identically in 2 files — src/servers/src/hint_headers.rs, src/session/src/query_options.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/datatypes/src/arrow_array.rs:160 — `key_type.is_integer() && value_type.is_string()` appears character-identically in 2 files — src/datatypes/src/arrow_array.rs, src/metric-engine/src/batch_modifier.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/common/meta/src/key/table_repart.rs:355 — `new_value.src_to_dst.is_empty() && current.is_none()` appears character-identically in 2 files — src/common/meta/src/key/table_repart.rs, src/meta-srv/src/gc/procedure.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate src/meta-srv/src/selector/lease_based.rs:78 — `opts.affinity.is_some() && ctx.affinity_fallback == AffinityFallback::Unconstrained && available < required` appears character-identically in 3 files — src/meta-srv/src/selector/lease_based.rs, src/meta-srv/src/selector/load_based.rs, src/meta-srv/src/selector/round_robin.rs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • + 15 more in this group — see findings.md.
X4 · Structured logging · Interpolated log message defeats structured logging · ×40
  • Interpolated log message defeats structured logging src/servers/src/addrs.rs:33 — `warn!` at line 33 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/elasticsearch.rs:137 — `debug!` at line 137 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/elasticsearch.rs:393 — `debug!` at line 393 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/grpc.rs:109 — `info!` at line 109 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/grpc.rs:113 — `error!` at line 113 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/grpc.rs:387 — `info!` at line 387 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/grpc.rs:412 — `warn!` at line 412 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/http.rs:1659 — `info!` at line 1659 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/http.rs:1710 — `info!` at line 1710 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/otel_arrow.rs:135 — `error!` at line 135 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/server.rs:103 — `info!` at line 103 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/server.rs:126 — `info!` at line 126 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/server.rs:175 — `error!` at line 175 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/server.rs:180 — `info!` at line 180 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/server.rs:207 — `info!` at line 207 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/postgres/handler.rs:854 — `debug!` at line 854 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/postgres/handler.rs:855 — `info!` at line 855 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/postgres/server.rs:165 — `debug!` at line 165 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/postgres/server.rs:169 — `debug!` at line 169 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/postgres/utils.rs:27 — `debug!` at line 27 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/postgres/copy_in/mod.rs:904 — `info!` at line 904 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/mysql/handler.rs:196 — `error!` at line 196 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/mysql/handler.rs:434 — `debug!` at line 434 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/mysql/handler.rs:460 — `debug!` at line 460 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging src/servers/src/mysql/handler.rs:465 — `debug!` at line 465 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • + 15 more in this group — see findings.md.
D31 · IaC & Container Security · Low IaC · ×12
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
P10 · Library API & versioning · Implementation type on the public API · ×11
  • Implementation type on the public API src/common/event-recorder/src/recorder.rs:323 — 1 public type in `common_event_recorder.recorder` is marked as implementation by its own namespace, folder or name: `EventRecorderImpl` (src/common/event-recorder/src/recorder.rs:323, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/common/meta/src/kv_backend/rds.rs:147 — 1 public type in `common_meta.kv_backend.rds` is marked as implementation by its own namespace, folder or name: `ExecutorImpl` (src/common/meta/src/kv_backend/rds.rs:147, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/common/stat/src/resource.rs:96 — 1 public type in `common_stat.resource` is marked as implementation by its own namespace, folder or name: `ResourceStatImpl` (src/common/stat/src/resource.rs:96, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/frontend/src/events.rs:30 — 1 public type in `frontend.events` is marked as implementation by its own namespace, folder or name: `EventHandlerImpl` (src/frontend/src/events.rs:30, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/index/src/bloom_filter/reader.rs:210 — 1 public type in `index.bloom_filter.reader` is marked as implementation by its own namespace, folder or name: `BloomFilterReaderImpl` (src/index/src/bloom_filter/reader.rs:210, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/log-store/src/kafka.rs:31 — 2 public types in `log_store.kafka` are marked as implementation by their own namespace, folder or name: `NamespaceImpl` (src/log-store/src/kafka.rs:31, name ends in `Impl`), `EntryImpl` (src/log-store/src/kafka.rs:38, name ends in `Impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
  • Implementation type on the public API src/meta-srv/src/event.rs:30 — 1 public type in `meta_srv.event` is marked as implementation by its own namespace, folder or name: `EventHandlerImpl` (src/meta-srv/src/event.rs:30, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/meta-srv/src/metasrv.rs:100 — 1 public type in `meta_srv.metasrv` is marked as implementation by its own namespace, folder or name: `BackendImpl` (src/meta-srv/src/metasrv.rs:100, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/mito2/src/flush.rs:118 — 1 public type in `mito2.flush` is marked as implementation by its own namespace, folder or name: `WriteBufferManagerImpl` (src/mito2/src/flush.rs:118, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/operator/src/statement.rs:983 — 1 public type in `operator.statement` is marked as implementation by its own namespace, folder or name: `InserterImpl` (src/operator/src/statement.rs:983, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
  • Implementation type on the public API src/plugins/src/options.rs:39 — 1 public type in `plugins.options` is marked as implementation by its own namespace, folder or name: `PluginOptionsDeserializerImpl` (src/plugins/src/options.rs:39, name ends in `Impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
D16 · Bus Factor · Off-boarding risk · ×9
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 46 significant file(s) lose their only recent owner: src/common/meta/src/reconciliation/utils.rs, src/meta-srv/src/procedure/repartition/repartition_start.rs, src/meta-srv/src/procedure/repartition/plan.rs, src/meta-srv/src/event/repartition.rs, src/common/telemetry/src/logging/file_retention.rs, src/meta-srv/src/procedure/repartition/group.rs, src/meta-srv/src/procedure/region_migration/open_candidate_region.rs, src/meta-srv/src/procedure/region_migration/utils.rs (+38 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 30 significant file(s) lose their only recent owner: src/log-store/src/object_store_wal/store.rs, src/cli/src/data/export_v2/command.rs, src/cli/src/data/snapshot_storage.rs, src/log-store/src/object_store_wal/format.rs, src/operator/src/statement/export_logical_tables/tests.rs, src/cli/src/data/import_v2/coordinator.rs, src/cli/src/data/export_v2/tests.rs, src/cli/src/data/import_v2/command.rs (+22 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 22 significant file(s) lose their only recent owner: src/flow/src/batching_mode/task/test.rs, src/flow/src/batching_mode/utils/test.rs, src/flow/src/batching_mode/task.rs, src/query/src/dist_plan/remote_dyn_filter_registry.rs, src/flow/src/batching_mode/utils.rs, src/flow/src/batching_mode/time_window.rs, src/datanode/src/region_server/remote_dyn_filter.rs, src/query/src/dist_plan/analyzer/utils.rs (+14 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 11 significant file(s) lose their only recent owner: src/mito2/src/series_index/tests.rs, src/mito2/src/series_index/bucket.rs, src/mito2/src/series_index/builder.rs, src/cmd/src/datanode/parquet_rewrite.rs, src/mito2/src/series_index/maintenance.rs, src/mito2/src/series_index/catalog.rs, src/cmd/src/datanode/parquet_meta.rs, src/mito2/src/sst/parquet/index_writer.rs (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 9 significant file(s) lose their only recent owner: src/mito2/src/compaction/last_non_null.rs, src/common/function/src/uddsketch_compat.rs, src/query/src/optimizer/infer_aggregate_input_bounds.rs, src/mito2/src/compaction/overlap.rs, src/mito2/src/compaction/picker.rs, src/mito2/src/compaction/unit.rs, src/common/grpc/src/flight/do_put.rs, src/common/meta/src/ddl/drop_table/metadata.rs (+1 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 9 significant file(s) lose their only recent owner: src/operator/src/statement/semantic_graph/relationships.rs, src/operator/src/statement/semantic_graph.rs, src/servers/src/http/jaeger/v3.rs, src/catalog/src/system_schema/semantic_graph.rs, src/servers/src/http/jaeger/v3/otlp.rs, src/common/function/src/scalars/json/json_object.rs, src/cmd/src/user.rs, src/promql/src/functions/vector_matching.rs (+1 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 5 significant file(s) lose their only recent owner: src/common/query/src/native_histogram/encoding.rs, src/servers/src/otlp/metrics/translator.rs, src/servers/src/otel_arrow.rs, src/common/query/src/promql_annotations.rs, src/common/frontend/src/metrics.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #8 — If anonymized user #8 becomes unavailable, 4 significant file(s) lose their only recent owner: src/datatypes/src/vectors/json/variant.rs, src/common/function/src/scalars/json/json_is.rs, src/common/function/src/scalars/json/json_path_match.rs, src/common/function/src/scalars/json/parse_json.rs. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #9 — If anonymized user #9 becomes unavailable, 3 significant file(s) lose their only recent owner: src/common/recordbatch/src/cursor.rs, src/common/telemetry/src/tracing_context.rs, src/datatypes/src/extension/histogram.rs. Pair on, review, or document these before any departure.
D20 · ADR Quality · ADR has no Decision and Consequences section · ×9
  • ADR has no Decision and Consequences section docs/rfcs/2022-12-20-promql-in-rust/rfc.md:11 — docs/rfcs/2022-12-20-promql-in-rust/rfc.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2023-01-03-procedure-framework.md:11 — docs/rfcs/2023-01-03-procedure-framework.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2023-12-22-enclose-column-id.md:8 — docs/rfcs/2023-12-22-enclose-column-id.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2024-08-06-json-datatype.md:8 — docs/rfcs/2024-08-06-json-datatype.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2025-02-06-remote-wal-purge.md:8 — docs/rfcs/2025-02-06-remote-wal-purge.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2025-06-20-repartition.md:8 — docs/rfcs/2025-06-20-repartition.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2025-07-04-compatibility-test-framework.md:8 — docs/rfcs/2025-07-04-compatibility-test-framework.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2025-08-16-async-index-build.md:8 — docs/rfcs/2025-08-16-async-index-build.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
  • ADR has no Decision and Consequences section docs/rfcs/2025-12-05-vector-index.md:8 — docs/rfcs/2025-12-05-vector-index.md has no Decision and Consequences section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
X7 · Silent fallback defaults · Silent fallback default on Err · ×4
  • Silent fallback default on Err src/common/query/src/native_histogram.rs:1318 — `get_bound` turns every `Err` into `Some(0.0)` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err src/servers/src/mysql/handler.rs:496 — `version` turns every `Err` into `"8.4.2".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err tests-fuzz/src/utils.rs:162 — `get_gt_fuzz_dump_dir` turns every `Err` into `"/tmp/greptime-fuzz-dumps".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
  • Silent fallback default on Err tests-fuzz/src/utils.rs:168 — `get_gt_fuzz_dump_suffix` turns every `Err` into `".repartition-metric-csv".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×3
  • Silent fallback default on parse failure .github/scripts/jsonbench-summary.py:41 — `format_gb` returns `'N/A'` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure .github/scripts/query-regression-summary.py:31 — `fmt_ms` returns `'N/A'` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure .github/scripts/query-regression-summary.py:64 — `regression_pct` returns `'N/A'` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
X9 · Subsumed condition operand · Subsumed condition operand · ×2
  • Subsumed condition operand src/query/src/dist_plan/analyzer/test.rs:3125 — `remote_section.contains("1700000000000000000")` can never decide this `||` — every value satisfying `remote_section.contains("1700000000000000000")` also satisfies `remote_section.contains("1700000000000")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand src/common/function/src/scalars/ip/cidr.rs:365 — `str_addr.starts_with("2001:db8::")` can never decide this `||` — every value satisfying `str_addr.starts_with("2001:db8::")` also satisfies `str_addr.starts_with("2001:db8:")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 7 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (147 single-owned of 1709 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1709 of the 2089 production source files in this repository met that bar). They are anonymized user #10 (2 file(s)), anonymized user #11 (1 file(s)), anonymized user #12 (1 file(s)), anonymized user #13 (1 file(s)), anonymized user #14 (1 file(s)), anonymized user #15 (1 file(s)) (+1 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: src/promql/src/range_array.rs, src/query/src/optimizer/promql_tsid_narrow_join.rs, src/common/meta/src/reconciliation/event.rs, src/catalog/src/system_schema/predicate.rs, src/mito2/src/wal/encoder.rs, src/common/time/src/duration.rs, src/common/function/src/scalars/json/json_object_keys.rs, src/servers/src/http/splunk.rs.
D20 · ADR Quality · ADR considers only one option · ×1
  • ADR considers only one option docs/rfcs/2023-05-09-distributed-planner.md:133 — `docs/rfcs/2023-05-09-distributed-planner.md:133` lists one option, one sub-heading, so the record shows no choice being made. List the alternatives that were rejected and why, or remove the section.
D20 · ADR Quality · ADR has no Decision section · ×1
  • ADR has no Decision section docs/rfcs/2025-07-23-global-gc-worker.md:8 — docs/rfcs/2025-07-23-global-gc-worker.md has no Decision section (a heading such as `## Decision`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 10 of 71 project(s) overshoot their size bounds, lowering Project Cohesion to 7.2/10. The most over is `src/mito2` (168417 LoC, 464 module-visible types across 32 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 96 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: src/datatypes/src/vectors/decimal.rs, src/sql/src/statements/transform/expand_interval.rs, src/index/src/inverted_index/search/index_apply/predicates_apply.rs, src/common/decimal/src/decimal128.rs, src/pipeline/src/etl/processor/digest.rs, src/index/src/inverted_index/search/fst_apply/intersection_apply.rs, src/partition/src/subtask.rs, src/partition/src/overlap.rs (and 88 more) (97 orphaned of 1709 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 1709 of the 2089 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D40 · Network Egress Confinement · No network policy · ×1
  • No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
D41 · Kernel & Syscall Confinement · No seccomp profile · ×1
  • No seccomp profile REDACTED:2 — The workload runs a container with no seccomp profile in force (neither RuntimeDefault nor a Localhost profile, on the container or the pod), so Kubernetes runs it Unconfined. Seccomp blocks the syscalls a container never needs, shrinking the kernel attack surface a container escape would use.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation .github/scripts/package.json:6 — `.github/scripts/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
S1 · Web-Security Posture · No security response headers detected · ×1
  • No security response headers detected — None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is set on a response this repository's Rust server sends — defense in depth, even when a proxy could set them. (−2.0 on this card.) The server: `axum::serve(` (src/servers/src/http.rs:1684).
X5 · Nullable reference types · Strict null checking is not enabled everywhere the repository type-checks · ×1
  • Strict null checking is not enabled everywhere the repository type-checks — 0/1 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
Minor — 91 finding(s)
D12 · Dependency Hygiene · Outdated · ×83
  • Outdated: anyhow — `anyhow` is locked at 1.0.102 but 1.0.104 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in src/common/mem-prof/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p anyhow` and commit the updated REDACTED.
  • Outdated: arbitrary — `arbitrary` is locked at 1.4.1 but 1.5.0 is the current stable release on crates.io, and it already satisfies the `"1.3.0"` requirement declared in tests-fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arbitrary` and commit the updated REDACTED.
  • Outdated: arc-swap — `arc-swap` is locked at 1.7.1 but 1.9.5 is the current stable release on crates.io, and it already satisfies the `"1.6"` requirement declared in src/client/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p arc-swap` and commit the updated REDACTED.
  • Outdated: async-compression — `async-compression` is locked at 0.4.41 but 0.4.52 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in src/puffin/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-compression` and commit the updated REDACTED.
  • Outdated: async-recursion — `async-recursion` is locked at 1.1.1 but 1.2.0 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in src/query/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-recursion` and commit the updated REDACTED.
  • Outdated: async-trait — `async-trait` is locked at 0.1.89 but 0.1.92 is the current stable release on crates.io, and it already satisfies the `"0.1"` requirement declared in tests-fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-trait` and commit the updated REDACTED.
  • Outdated: async-walkdir — `async-walkdir` is locked at 2.1.0 but 2.2.0 is the current stable release on crates.io, and it already satisfies the `"2.0.0"` requirement declared in src/puffin/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p async-walkdir` and commit the updated REDACTED.
  • Outdated: auto_impl — `auto_impl` is locked at 1.3.0 but 1.4.0 is the current stable release on crates.io, and it already satisfies the `"1.2.0"` requirement declared in src/puffin/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p auto_impl` and commit the updated REDACTED.
  • Outdated: axum — `axum` is locked at 0.8.4 but 0.8.9 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in tests-fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p axum` and commit the updated REDACTED.
  • Outdated: axum-macros — `axum-macros` is locked at 0.5.0 but 0.5.1 is the current stable release on crates.io, and it already satisfies the `"0.5"` requirement declared in src/meta-srv/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p axum-macros` and commit the updated REDACTED.
  • Outdated: backtrace — `backtrace` is locked at 0.3.75 but 0.3.77 is the current stable release on crates.io, and it already satisfies the `"0.3"` requirement declared in src/common/telemetry/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p backtrace` and commit the updated REDACTED.
  • Outdated: bigdecimal — `bigdecimal` is locked at 0.4.8 but 0.4.11 is the current stable release on crates.io, and it already satisfies the `"0.4.2"` requirement declared in src/common/decimal/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bigdecimal` and commit the updated REDACTED.
  • Outdated: bitflags — `bitflags` is locked at 2.12.1 but 2.13.2 is the current stable release on crates.io, and it already satisfies the `"2.4.1"` requirement declared in src/puffin/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bitflags` and commit the updated REDACTED.
  • Outdated: bitvec — `bitvec` is locked at 1.0.1 but 1.1.1 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in src/common/base/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bitvec` and commit the updated REDACTED.
  • Outdated: bytemuck — `bytemuck` is locked at 1.23.1 but 1.25.2 is the current stable release on crates.io, and it already satisfies the `"1.12"` requirement declared in src/index/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytemuck` and commit the updated REDACTED.
  • Outdated: bytes — `bytes` is locked at 1.11.1 but 1.12.1 is the current stable release on crates.io, and it already satisfies the `"1.11"` requirement declared in src/catalog/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p bytes` and commit the updated REDACTED.
  • Outdated: cap-std — `cap-std` is locked at 4.0.2 but 4.0.3 is the current stable release on crates.io, and it already satisfies the `"4.0"` requirement declared in src/object-store/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cap-std` and commit the updated REDACTED.
  • Outdated: clap — `clap` is locked at 4.5.40 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.4"` requirement declared in tests-fuzz/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
  • Outdated: const_format — `const_format` is locked at 0.2.34 but 0.2.37 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in src/common/catalog/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p const_format` and commit the updated REDACTED.
  • Outdated: crc32fast — `crc32fast` is locked at 1.4.2 but 1.5.5 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in src/log-store/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crc32fast` and commit the updated REDACTED.
  • Outdated: crossbeam-utils — `crossbeam-utils` is locked at 0.8.21 but 0.8.23 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in src/mito2/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p crossbeam-utils` and commit the updated REDACTED.
  • Outdated: csv — `csv` is locked at 1.3.1 but 1.4.0 is the current stable release on crates.io, and it already satisfies the `"1.3"` requirement declared in src/pipeline/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p csv` and commit the updated REDACTED.
  • Outdated: deadpool-postgres — `deadpool-postgres` is locked at 0.14.1 but 0.14.2 is the current stable release on crates.io, and it already satisfies the `"0.14"` requirement declared in src/meta-srv/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p deadpool-postgres` and commit the updated REDACTED.
  • Outdated: derive_more — `derive_more` is locked at 2.1.0 but 2.1.1 is the current stable release on crates.io, and it already satisfies the `"2.1"` requirement declared in src/mito2/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p derive_more` and commit the updated REDACTED.
  • Outdated: either — `either` is locked at 1.15.0 but 1.19.0 is the current stable release on crates.io, and it already satisfies the `"1.15"` requirement declared in src/datanode/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p either` and commit the updated REDACTED.
  • + 58 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×8
  • Off the main sequence: common-version — common-version: abstractness 0.00, instability 0.00, distance 1.00 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-batcher — common-batcher: abstractness 0.11, instability 0.00, distance 0.89 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-telemetry — common-telemetry: abstractness 0.06, instability 0.07, distance 0.87 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-time — common-time: abstractness 0.14, instability 0.06, distance 0.80 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-cache — common-cache: abstractness 0.00, instability 0.25, distance 0.75 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-runtime — common-runtime: abstractness 0.17, instability 0.12, distance 0.72 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-decimal — common-decimal: abstractness 0.00, instability 0.29, distance 0.71 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: common-base — common-base: abstractness 0.29, instability 0.00, distance 0.71 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-01711a4255124fe09030d04dbebe647f/history.json --exit-code 0 --source .3artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-01711a4255124fe09030d04dbebe647f/tree.json --exit-code 0 --source .1artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .484artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .80artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .82artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 1 file(s) — `.github/scripts/query-regression-comment.cjs` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1db35-a588-7dee-9b48-f30ce425efa4 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md