Skip to content

perf(ci): scope SCA by Go dependencies and shorten freshness BVT - #30442

Merged
XuPeng-SH merged 9 commits into
mainfrom
codex/ci-sca-bvt-20261016
Oct 17, 2026
Merged

XuPeng-SH merged 9 commits into
mainfrom
codex/ci-sca-bvt-20261016

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Refs #29249

What this PR does / why we need it:

Reduce SCA work for bounded Go changes and remove production-cadence waiting from a fulltext freshness BVT, while retaining the existing full gates and every original BVT oracle.

Design

  • Reuse change-scope.cjs for immutable base/head tree resolution. Missing history, revision mismatch, dirty inputs, uncertain paths, deleted packages and broad closures retain full SCA.
  • Use one Go-owned production/test import inventory. Production edits select whole owning packages and transitive reverse importers, including test-only importers; test-only edits select the whole owning package. Both pinned analyzers consume the same selection through the existing Make recipes. No changed-line filtering, new cache, analyzer exclusions, or reduced test mode.
  • Check Go-reported sources against tracked regular files. Ignored/generated Go inputs and source symlinks force full analysis: Git status alone can miss compiler inputs. Keep the full local/release/cache-producer targets and SCA_FULL=1 override.
  • Keep both complete BVT groups. The warm-cache freshness scenario uses the existing timer-only control, checks CN fan-out, and restores the default. No explicit eviction replaces the periodic-sweep oracle.
  • Extend the CI scope contract workflow to cover its actual Make/toolchain inputs. Operational design: .github/ci/README.md.

Common CI fixture correction

The report-open failure fixture shared by #30399 and this PR allowed five mock shards to overwrite one PID file. A controlled truncate-before-write interleaving reproduced exit 94 with all five mock processes still alive. Reuse the admission-owned owned-pids ledger for survival checks and delete the mock-written PID file. Existing exit-125, artifact-preservation and cleanup assertions remain. Historical CI logs lack the PID snapshot needed to attribute their exact interleaving.

Measured local results

Linux/x86, Go 1.27.1, existing pinned molint and golangci-lint v2.14.0, GOMAXPROCS=2, golangci concurrency=1. Analyzer comparisons use independent copies of the same warm analysis cache; the shared Go compiler cache is warmer for the full run because selection runs first. Timings include planning, policy checks and both analyzers.

SCA scenario Full Selected CPU time, full → selected Golangci sampled memory peak
Narrow production edit, 35/509 packages 322.4s 201.1s 613.3s → 462.9s 6166.6 → 4943.9 MB
Fileservice test-only edit 196.0s 14.9s 198.8s → 18.2s 6017.7 → 648.6 MB

The two-CN freshness case improved from 920.114s, 223/223 checks to 179.387s, 227/227 checks; a same-instance rerun passed 227/227 in 177.699s. The original 223 checks remain; four statements add control/fan-out/restoration checks.

These are measured examples, not a whole-CI speedup claim. The observed CI case previously took 388s because the default timer phase varies. The opposite BVT group still bounds BVT wall time; no group was dropped or rebalanced. External license/native preparation remains unchanged. This PR itself changes CI/Make inputs, so its SCA deliberately takes the full fallback.

Validation

  • All 36 CI contract tests passed with Go 1.27.1 and 1.26.4, including real Go discovery and actual Make recipes, argument/failure propagation, full override, invalid discovery, and the ignored-source regression (proved failing before the fix).
  • Pinned full SCA passed; narrow production, test-only, forced-full controls and the delivery branch's real unknown-input/full fallback all passed. Final broad fallback: 197.915s, exit 0, zero golangci issues.
  • Native and service builds passed. Two-CN BVT normal comparisons and same-instance rerun passed. After a commit barrier, both CNs reported zero leftover scenario tables/indexes; all four test-owned processes shut down in dependency order. Other host services were left running.
  • No production Go, data format, authorization, coverage instrumentation or required-check policy changed. The optools fixture correction also passed focused Go race validation.
  • Design and final overall review: gpt-6.1-sol / xhigh, approved after fixing the ignored-source counterexample. Review notes and temporary performance-probe commits are not included.

Fixture validation: the complete optools package passed in Linux/x86 Coverage mode (360 test/subtest pass events, zero skips, 27.403s). The failing subcase passed 100 focused race repetitions (25.527s); incremental go vet, pinned molint and golangci-lint passed (zero golangci issues). No production scheduling script changed.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: f1edd1ac6e00e24f7d20718f29735682d5fe2140

"interrupted"

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: 1019d8fbc3692c4cb7f09427d30373d4b272ae67

Review belongs to an older commit; it is not a review of the current head.

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 5b901287d57717157da312eaffc585d1d619896a

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 5b901287d57717157da312eaffc585d1d619896a

Assessment: request_changes

Reviewed the complete eight-file delta and relevant callers and owners. The design appropriately shares Go dependency discovery and analyzer recipes and reuses the existing freshness timer control. No implementation defect was confirmed, but two required execution-validation contracts remain open.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

  • P2 .github/ci/static-analysis.cjs:161: Validation requirement: bounded production and test-only changes now restrict both analyzers to selected packages.
    Impact: The verified contract tests use recording analyzer stubs; they do not establish the pinned analyzers' behavior or the reported performance improvement.
    Evidence: README.md:54–61 explicitly requires real-analyzer validation. local_validation is empty, frozen SCA remains IN_PROGRESS, and recovered receipts contain no real-analyzer executions. Supply matching command/source/exit records and logs for the reported full, narrow-production, test-only and fallback runs, or execute only the missing modes.

  • P2 test/distributed/cases/pessimistic_transaction/fulltext2/fulltext2_async.sql:116: Validation requirement: the freshness deadline changes from 900 to 60 seconds while applying and restoring a process-global interval across CNs.
    Impact: Static inspection cannot establish timely periodic refresh, successful fan-out, restoration and cleanup through the actual multi-CN test runner.
    Evidence: The documented contract requires normal mo-tester comparison, a same-instance rerun and teardown checks. The author reports successful runs, but supplied and recovered evidence lacks their reports, source/binary identity, commands and exit records. Provide matching retained artifacts or run the changed case twice on a test-owned multi-CN cluster and retain restoration/cleanup evidence.

Validation:

  • Verified clean frozen HEAD, complete delta and tree identity with 7ac9613.

  • Reused 36 passing Node contract tests after independently reconciling 13 unchanged inputs, original clean-source receipts and passing TAP logs. These cover actual Go discovery and Make recipes with analyzer stubs.

  • Current evidence audit passed and verified preservation of every original BVT result line. Records: /home/xupeng/.local/state/mo-bot/jobs/0a54b3a7b5bee21e5e14fcdf/attempt-1/evidence-audit.json and evidence-audit.log; matching receipt: checks/1792193960226899840-4.json.

Limitations:

  • No real-analyzer, native or BVT execution occurred in this attempt. Reported timings remain author measurements without independently reconciled execution artifacts.

  • Production SQL paths are unchanged; added costs are CI graph discovery and temporarily faster background freshness scans during the BVT.

  • The linked issue body and external reusable CI/test-runner implementations were absent from the frozen evidence. Implementation inspection is complete; execution acceptance remains open.

@XuPeng-SH

XuPeng-SH commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: e40da98c3cab9425e032f49bd18098e70537f4fd

"interrupted"

@XuPeng-SH

XuPeng-SH commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: 655335d610a4c3a37f30a1a344ee0f74c516259b

Review belongs to an older commit; it is not a review of the current head.

@XuPeng-SH
XuPeng-SH merged commit 65bcea5 into main Oct 17, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/ci-sca-bvt-20261016 branch October 17, 2026 00:38
mergify Bot pushed a commit that referenced this pull request Oct 17, 2026
)

Parallel non-strict CSV LOAD can split a valid quoted multiline field at a physical newline, causing reader errors or incorrect records. Choose split points by replaying the production CSV parser from the preceding confirmed record boundary. The new `ScanRecord` operation shares framing and header handling with `Read` while skipping the field decoding and unescaping that partition planning discards.

Keep best-effort legacy splitting after a CSV syntax failure. Propagate configuration, storage, cancellation and resource-limit errors; close scan readers before fallback; preserve EOF and close-error handling. Retain the configured, overlap-aware physical terminator fallback and bounded worker assignment from main.

The SQL regression uses the existing one-CN integration fixture and a service/path-scoped testing threshold, with a private local worker budget capped by CPUs and query `max_dop`. This allows a 58-byte input to exercise real parallel admission and execution without a large fixture. Production thresholds are unchanged. Both LOAD planning entrypoints use the shared admission helper, and observer callbacks receive copied offsets.

Validation before the CI follow-up (`mo-cgo-test`, Go 1.27.1, Darwin/arm64):

- Full short owning-package tests passed for csvparser, runtime, external, plan and compile, excluding the then-baseline-proven unrelated Arrow fixture. Parser framing/Read interoperation, multiline/custom delimiters, syntax fallback, cancellation/error cleanup and worker assignment regressions passed; full csvparser/runtime race tests also passed.
- `TestLoadCSVParallelNonStrictMultiline` passed through the MySQL frontend normally and under race. It observes two actual ranges `[0,39)` and `[39,EOF)` with nominal split 29 inside the quoted field, checks complete multiline/escaped values and exactly IDs 1, 2, 3 without a uniqueness constraint, and checks serial execution. Mutating the observer's private offset copy does not affect execution.
- The same SQL regression fails with only the splitter replaced by exact official-base `external.go`: ranges become `[0,36)` and `[36,EOF)`, and LOAD reports mismatched input columns. This is a read-only source overlay retaining the test control.
- Incremental golangci-lint across all six changed packages reported 0 issues; vet, gofmt and diff checks passed.

CI follow-up and error propagation:

- Reproduced the Ubuntu/x86 ordinary and coverage UT failure in `TestReadFileOffsetClosesTailScanReaders/partial_read_error`. The first CSV replay probe now reports the injected storage error immediately; the old test expected three probes from physical-line guessing. Correct the expected reader count to one, retaining the positive-byte-plus-error injection, exact error identity, nil offsets and close-once checks. Retain the remote follow-up's separate JSONLINE three-probe cleanup case and exact open-attempt assertions. No extra production probes are introduced to satisfy the old assertion.
- Fix #30446 in the shared CSV parser: COMMENT lookahead and STARTING BY scanning must propagate non-EOF I/O errors. Previously, a one-time read error could be discarded and later reads could produce success. The narrow guards apply to both `Read` and `ScanRecord`, preserving normal EOF and unterminated final records. This adds no retry, state or persistent format change.
- Before the correction, all four parser fault-injection cases and the boundary-reader error/cleanup case failed. An exact-main parser-source overlay also reproduced both legacy `Read` failures; this is parser-level evidence, not a full clean-main SQL reproduction.
- Rebased onto official main `65bcea5d24610dde1a21bb9f4dea1efd82a8ce50`, including #30442's shared mock PID fixture correction for the other coverage failure. This PR adds no runner-process changes.

Current Linux/x86 validation (Go 1.27.1, `mo-cgo-test`, `matrixone_test`, bounded GOMAXPROCS=2):

- Full csvparser tests passed normally and under race (0.031s / 1.136s), including COMMENT/STARTING BY one-time I/O errors through both parser entrypoints and final-record EOF controls.
- Full external tests passed normally and under race (35.741s / 36.668s), including the CI-named cleanup failure and the new boundary-reader storage-error/close-once regression. The corrected prescan parent test also passed with coverage instrumentation.
- The public one-CN `TestLoadCSVParallelNonStrictMultiline` passed normally and under race (8.568s / 8.225s) after the error-propagation correction.
- Runtime normal/race tests passed. Incremental golangci-lint across all six affected packages reports 0 issues; vet, formatting and diff checks passed. The repository molint command completed successfully; its diagnostics point to unchanged Arrow/plan/compile code outside this PR.
- New remote CI remains pending after delivery. The earlier failed coverage run did not produce a repository-wide coverage verdict.

Planning benchmark: approximately 16 MiB, eight ranges, production parser configuration, one excluded warm-up followed by three measured rounds per input/method (`BenchmarkNonStrictCSVBoundaryFraming`, `-benchtime=1x`, measured `-count=3`). Every sample asserts identical boundaries and 16,056,320 bytes read, including read-ahead. Medians on Apple M4, GOMAXPROCS=10:

| Input | Read time | ScanRecord time | Read allocations | ScanRecord allocations |
| --- | ---: | ---: | ---: | ---: |
| Plain CSV | 127.622 ms | 54.555 ms | 323 | 316 |
| Escaped multiline CSV | 184.686 ms | 78.803 ms | 1,761,926 | 309 |

Escaped-input allocated bytes drop from 21,130,072 to 2,337,472 per operation. These are warmed in-memory boundary-planning measurements; SQL throughput, remote storage latency and concurrent-load effects were not measured. Partition planning still adds a serial framing pass plus per-reader read-ahead and opens. Syntax fallback remains best effort for malformed files. The original #30378 is left open for reporter verification after merge.

Approved by: @XuPeng-SH

This branch was previously deployed

1 inactive deployment
ci — 655335d6 Deployed Oct 17, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants