Skip to content

ci: make SCA analysis cache compression portable - #28166

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-sca-cache-compression
Sep 4, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/fix-sca-cache-compression

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:

Refs #28100

What this PR does / why we need it:

The trusted SCA analysis-cache producer introduced by #28101 completed the full golangci-lint run twice, then failed before publication because the arm64-mo-shanghai-4c8g image has libzstd-dev but no zstd command in PATH:

Both runs ended with 0 issues after 30m06s / 26m29s, then failed at the archive-size estimate with zstd: command not found. Consequently no trusted analysis cache was saved and PR SCA consumers continued to take the complete cold path.

This change makes the producer follow the same compression capability contract as actions/[email protected]:

  • resolve compression after environment setup and before cache restore or expensive analysis;
  • use zstd only when zstd, zstdmt, and unzstd form a complete toolchain that passes a byte-level round trip;
  • otherwise use the supported gzip fallback already selected internally by actions/cache;
  • fail immediately with an actionable message when neither method is usable, a compressor round trip fails, or zstd is only partially installed;
  • estimate the publication size using the selected method, including zstdmt to match the actual cache creation path;
  • retain the existing empty-cache, 200,000-file, and 160-MiB compressed-size bounds.

The producer does not install packages at runtime. A per-job package installation would add a network dependency and startup cost to solve a case that actions/cache already supports natively.

Correctness, safety, and unhappy paths

  • Analyzer selection, package coverage, license checks, and PR failure semantics are unchanged.
  • Only the trusted main producer can publish; PR jobs remain restore-only.
  • Compression method values are produced internally and consumed through an explicit zstd / gzip case, with unknown values rejected.
  • set -euo pipefail still makes tar or compressor failures terminal instead of accepting a truncated size.
  • A missing or partial compressor now fails before the 26–30 minute cold golangci run.
  • actions/cache owns gzip/zstd archive compatibility and includes the compression method in its internal cache version, so a future runner-image transition causes a safe cache miss and one new warm publication.

Performance and resource impact

Measured locally with the representative #28101 golangci cache (89,757 files, 353 MiB filesystem usage):

Method Archive bytes Estimate time
zstdmt 6,971,000 10.06s
gzip 8,055,900 10.83s

For this representative cache, gzip adds about 1.1 MiB and 0.77s, remains far below the 160-MiB budget, and avoids a new network/package-manager dependency. The analysis itself remains the dominant cold cost; once publication succeeds, later PR jobs can restore the analysis cache.

QA test plan

  • actionlint 1.7.12 passes for .github/workflows/sca-go-module-cache.yaml.
  • ShellCheck 0.11.0 passes for both modified Bash steps.
  • YAML parsing and git diff --check pass.
  • The exact compression-resolution step selects zstd and gzip only after a successful byte-level round trip.
  • The gzip-only simulation matches the observed Shanghai runner state.
  • Broken zstd, broken gzip, partial-zstd, and no-compressor simulations fail with the intended early errors.
  • The exact archive-budget block succeeds with both gzip and zstd on a non-empty cache.

Staged acceptance

After merge, the main push runs the trusted producer on the target ARM runner. Acceptance requires:

  1. Resolve analysis cache compression reports gzip on the current image;
  2. the warm step records a bounded non-empty archive and reaches Save golangci-lint analysis cache;
  3. a later PR SCA reports a usable exact or prefix analysis-cache restore;
  4. cache-hit analyzer and total SCA durations are compared with the existing CI: SCA critical path averages 40 minutes on ARM runner #28100 baseline.

If publication or restore remains unreliable, disabling the analysis-cache restore path rolls back only the optimization; SCA coverage remains complete.

@XuPeng-SH
XuPeng-SH requested a review from fengttt as a code owner September 4, 2026 11:15
@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 merged commit 4356759 into matrixorigin:main Sep 4, 2026
21 of 24 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/fix-sca-cache-compression branch September 4, 2026 12:24
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Which issue(s) this PR fixes:

Refs matrixorigin#28100

## What this PR does / why we need it:

The trusted SCA analysis-cache producer introduced by matrixorigin#28101 completed
the full golangci-lint run twice, then failed before publication because
the `arm64-mo-shanghai-4c8g` image has `libzstd-dev` but no `zstd`
command in `PATH`:

-
https://github.com/matrixorigin/matrixone/actions/runs/33852599450/job/100958542982
-
https://github.com/matrixorigin/matrixone/actions/runs/33859727455/job/100981164687

Both runs ended with `0 issues` after 30m06s / 26m29s, then failed at
the archive-size estimate with `zstd: command not found`. Consequently
no trusted analysis cache was saved and PR SCA consumers continued to
take the complete cold path.

This change makes the producer follow the same compression capability
contract as `actions/[email protected]`:

- resolve compression after environment setup and before cache restore
or expensive analysis;
- use zstd only when `zstd`, `zstdmt`, and `unzstd` form a complete
toolchain that passes a byte-level round trip;
- otherwise use the supported gzip fallback already selected internally
by `actions/cache`;
- fail immediately with an actionable message when neither method is
usable, a compressor round trip fails, or zstd is only partially
installed;
- estimate the publication size using the selected method, including
`zstdmt` to match the actual cache creation path;
- retain the existing empty-cache, 200,000-file, and 160-MiB
compressed-size bounds.

The producer does not install packages at runtime. A per-job package
installation would add a network dependency and startup cost to solve a
case that `actions/cache` already supports natively.

## Correctness, safety, and unhappy paths

- Analyzer selection, package coverage, license checks, and PR failure
semantics are unchanged.
- Only the trusted main producer can publish; PR jobs remain
restore-only.
- Compression method values are produced internally and consumed through
an explicit `zstd` / `gzip` case, with unknown values rejected.
- `set -euo pipefail` still makes tar or compressor failures terminal
instead of accepting a truncated size.
- A missing or partial compressor now fails before the 26–30 minute cold
golangci run.
- `actions/cache` owns gzip/zstd archive compatibility and includes the
compression method in its internal cache version, so a future
runner-image transition causes a safe cache miss and one new warm
publication.

## Performance and resource impact

Measured locally with the representative matrixorigin#28101 golangci cache (89,757
files, 353 MiB filesystem usage):

| Method | Archive bytes | Estimate time |
| --- | ---: | ---: |
| zstdmt | 6,971,000 | 10.06s |
| gzip | 8,055,900 | 10.83s |

For this representative cache, gzip adds about 1.1 MiB and 0.77s,
remains far below the 160-MiB budget, and avoids a new
network/package-manager dependency. The analysis itself remains the
dominant cold cost; once publication succeeds, later PR jobs can restore
the analysis cache.

## QA test plan

- `actionlint` 1.7.12 passes for
`.github/workflows/sca-go-module-cache.yaml`.
- ShellCheck 0.11.0 passes for both modified Bash steps.
- YAML parsing and `git diff --check` pass.
- The exact compression-resolution step selects zstd and gzip only after
a successful byte-level round trip.
- The gzip-only simulation matches the observed Shanghai runner state.
- Broken zstd, broken gzip, partial-zstd, and no-compressor simulations
fail with the intended early errors.
- The exact archive-budget block succeeds with both gzip and zstd on a
non-empty cache.

## Staged acceptance

After merge, the main push runs the trusted producer on the target ARM
runner. Acceptance requires:

1. `Resolve analysis cache compression` reports gzip on the current
image;
2. the warm step records a bounded non-empty archive and reaches `Save
golangci-lint analysis cache`;
3. a later PR SCA reports a usable exact or prefix analysis-cache
restore;
4. cache-hit analyzer and total SCA durations are compared with the
existing matrixorigin#28100 baseline.

If publication or restore remains unreliable, disabling the
analysis-cache restore path rolls back only the optimization; SCA
coverage remains complete.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Which issue(s) this PR fixes:

Refs matrixorigin#28100

## What this PR does / why we need it:

The trusted SCA analysis-cache producer introduced by matrixorigin#28101 completed
the full golangci-lint run twice, then failed before publication because
the `arm64-mo-shanghai-4c8g` image has `libzstd-dev` but no `zstd`
command in `PATH`:

-
https://github.com/matrixorigin/matrixone/actions/runs/33852599450/job/100958542982
-
https://github.com/matrixorigin/matrixone/actions/runs/33859727455/job/100981164687

Both runs ended with `0 issues` after 30m06s / 26m29s, then failed at
the archive-size estimate with `zstd: command not found`. Consequently
no trusted analysis cache was saved and PR SCA consumers continued to
take the complete cold path.

This change makes the producer follow the same compression capability
contract as `actions/[email protected]`:

- resolve compression after environment setup and before cache restore
or expensive analysis;
- use zstd only when `zstd`, `zstdmt`, and `unzstd` form a complete
toolchain that passes a byte-level round trip;
- otherwise use the supported gzip fallback already selected internally
by `actions/cache`;
- fail immediately with an actionable message when neither method is
usable, a compressor round trip fails, or zstd is only partially
installed;
- estimate the publication size using the selected method, including
`zstdmt` to match the actual cache creation path;
- retain the existing empty-cache, 200,000-file, and 160-MiB
compressed-size bounds.

The producer does not install packages at runtime. A per-job package
installation would add a network dependency and startup cost to solve a
case that `actions/cache` already supports natively.

## Correctness, safety, and unhappy paths

- Analyzer selection, package coverage, license checks, and PR failure
semantics are unchanged.
- Only the trusted main producer can publish; PR jobs remain
restore-only.
- Compression method values are produced internally and consumed through
an explicit `zstd` / `gzip` case, with unknown values rejected.
- `set -euo pipefail` still makes tar or compressor failures terminal
instead of accepting a truncated size.
- A missing or partial compressor now fails before the 26–30 minute cold
golangci run.
- `actions/cache` owns gzip/zstd archive compatibility and includes the
compression method in its internal cache version, so a future
runner-image transition causes a safe cache miss and one new warm
publication.

## Performance and resource impact

Measured locally with the representative matrixorigin#28101 golangci cache (89,757
files, 353 MiB filesystem usage):

| Method | Archive bytes | Estimate time |
| --- | ---: | ---: |
| zstdmt | 6,971,000 | 10.06s |
| gzip | 8,055,900 | 10.83s |

For this representative cache, gzip adds about 1.1 MiB and 0.77s,
remains far below the 160-MiB budget, and avoids a new
network/package-manager dependency. The analysis itself remains the
dominant cold cost; once publication succeeds, later PR jobs can restore
the analysis cache.

## QA test plan

- `actionlint` 1.7.12 passes for
`.github/workflows/sca-go-module-cache.yaml`.
- ShellCheck 0.11.0 passes for both modified Bash steps.
- YAML parsing and `git diff --check` pass.
- The exact compression-resolution step selects zstd and gzip only after
a successful byte-level round trip.
- The gzip-only simulation matches the observed Shanghai runner state.
- Broken zstd, broken gzip, partial-zstd, and no-compressor simulations
fail with the intended early errors.
- The exact archive-budget block succeeds with both gzip and zstd on a
non-empty cache.

## Staged acceptance

After merge, the main push runs the trusted producer on the target ARM
runner. Acceptance requires:

1. `Resolve analysis cache compression` reports gzip on the current
image;
2. the warm step records a bounded non-empty archive and reaches `Save
golangci-lint analysis cache`;
3. a later PR SCA reports a usable exact or prefix analysis-cache
restore;
4. cache-hit analyzer and total SCA durations are compared with the
existing matrixorigin#28100 baseline.

If publication or restore remains unreliable, disabling the
analysis-cache restore path rolls back only the optimization; SCA
coverage remains complete.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Which issue(s) this PR fixes:

Refs matrixorigin#28100

## What this PR does / why we need it:

The trusted SCA analysis-cache producer introduced by matrixorigin#28101 completed
the full golangci-lint run twice, then failed before publication because
the `arm64-mo-shanghai-4c8g` image has `libzstd-dev` but no `zstd`
command in `PATH`:

-
https://github.com/matrixorigin/matrixone/actions/runs/33852599450/job/100958542982
-
https://github.com/matrixorigin/matrixone/actions/runs/33859727455/job/100981164687

Both runs ended with `0 issues` after 30m06s / 26m29s, then failed at
the archive-size estimate with `zstd: command not found`. Consequently
no trusted analysis cache was saved and PR SCA consumers continued to
take the complete cold path.

This change makes the producer follow the same compression capability
contract as `actions/[email protected]`:

- resolve compression after environment setup and before cache restore
or expensive analysis;
- use zstd only when `zstd`, `zstdmt`, and `unzstd` form a complete
toolchain that passes a byte-level round trip;
- otherwise use the supported gzip fallback already selected internally
by `actions/cache`;
- fail immediately with an actionable message when neither method is
usable, a compressor round trip fails, or zstd is only partially
installed;
- estimate the publication size using the selected method, including
`zstdmt` to match the actual cache creation path;
- retain the existing empty-cache, 200,000-file, and 160-MiB
compressed-size bounds.

The producer does not install packages at runtime. A per-job package
installation would add a network dependency and startup cost to solve a
case that `actions/cache` already supports natively.

## Correctness, safety, and unhappy paths

- Analyzer selection, package coverage, license checks, and PR failure
semantics are unchanged.
- Only the trusted main producer can publish; PR jobs remain
restore-only.
- Compression method values are produced internally and consumed through
an explicit `zstd` / `gzip` case, with unknown values rejected.
- `set -euo pipefail` still makes tar or compressor failures terminal
instead of accepting a truncated size.
- A missing or partial compressor now fails before the 26–30 minute cold
golangci run.
- `actions/cache` owns gzip/zstd archive compatibility and includes the
compression method in its internal cache version, so a future
runner-image transition causes a safe cache miss and one new warm
publication.

## Performance and resource impact

Measured locally with the representative matrixorigin#28101 golangci cache (89,757
files, 353 MiB filesystem usage):

| Method | Archive bytes | Estimate time |
| --- | ---: | ---: |
| zstdmt | 6,971,000 | 10.06s |
| gzip | 8,055,900 | 10.83s |

For this representative cache, gzip adds about 1.1 MiB and 0.77s,
remains far below the 160-MiB budget, and avoids a new
network/package-manager dependency. The analysis itself remains the
dominant cold cost; once publication succeeds, later PR jobs can restore
the analysis cache.

## QA test plan

- `actionlint` 1.7.12 passes for
`.github/workflows/sca-go-module-cache.yaml`.
- ShellCheck 0.11.0 passes for both modified Bash steps.
- YAML parsing and `git diff --check` pass.
- The exact compression-resolution step selects zstd and gzip only after
a successful byte-level round trip.
- The gzip-only simulation matches the observed Shanghai runner state.
- Broken zstd, broken gzip, partial-zstd, and no-compressor simulations
fail with the intended early errors.
- The exact archive-budget block succeeds with both gzip and zstd on a
non-empty cache.

## Staged acceptance

After merge, the main push runs the trusted producer on the target ARM
runner. Acceptance requires:

1. `Resolve analysis cache compression` reports gzip on the current
image;
2. the warm step records a bounded non-empty archive and reaches `Save
golangci-lint analysis cache`;
3. a later PR SCA reports a usable exact or prefix analysis-cache
restore;
4. cache-hit analyzer and total SCA durations are compared with the
existing matrixorigin#28100 baseline.

If publication or restore remains unreliable, disabling the
analysis-cache restore path rolls back only the optimization; SCA
coverage remains complete.

This branch had an error being deployed

1 failed deployment
ci — 2a703961 Deployed Sep 4, 2026 by XuPeng-SH via Matrixone Utils CI / Coverage #50679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants