DoDiODev opened a new pull request, #9029: URL: https://github.com/apache/devlake/pull/9029
## Summary Bumps the mock-generation tool `github.com/vektra/mockery` from **v2.53.6** to **v3.7.2** at every install site (`backend/Makefile`, `backend/Dockerfile`, `backend/Dockerfile.local`, `devops/docker/lake-builder/Dockerfile`), and adds the two YAML configs mockery v3 requires instead of CLI flags. Current pinning (before this PR) is mockery v2.53.6 (released 2024); v3.7.2 is a rewrite with a new CLI/config surface (no code-generation logic changes for the mocks actually used by this repo — see "Behavioral changes" below). ## What changed | File | Change | |---|---| | `backend/Makefile` (`go-dep`, `mock`) | `[email protected]` → `@v3.7.2`; `mock` target invokes the **two** new configs in a **fixed order** | | `backend/Dockerfile` | install site `v2.53.6` → `v3.7.2` | | `backend/Dockerfile.local` | ditto | | `devops/docker/lake-builder/Dockerfile` | ditto | | `backend/.mockery.core.yml` (new) | v3 config for `core/` + `helpers/pluginhelper/subtaskmeta/sorter`, reproducing the v2 layout 1:1 | | `backend/.mockery.helpers.yml` (new) | v3 config for the remaining `helpers/` interfaces | **Why two configs?** `helpers/unithelper` **imports** the generated `mocks/core/...` packages. Unlike v2, v3 loads sources via `go/packages` **with type-checking**, so the core mocks must exist **before** the `helpers` tree is parsed. A single run across both trees fails after `rm -rf mocks` with `could not import .../mocks/core/... (invalid package name)`. Both configs reproduce the v2 layout 1:1 (`dir: mocks/{{.InterfaceDirRelative}}`, `filename: {{.InterfaceName}}.go`, `pkgname: mocks`, `structname: {{.InterfaceName}}`, `template: testify`, `template-data.unroll-variadic: false`), so existing imports such as `mockdal "github.com/apache/incubator-devlake/mocks/core/dal"` stay valid. ## Behavioral changes of v3 (documented for reviewers) 1. **No generated-code churn to review:** `backend/mocks/` is untracked (see `.gitignore`), so this diff is exactly the 6 files listed above — nothing under `backend/mocks/` is part of the PR. 2. **Function-type mocking is gone, interfaces only:** 13 mocks disappear (e.g. `plugin.ApiAsyncCallback`, `plugin.ApiResourceHandler`, `plugin.SubTaskEntryPoint`, `api.DataConvertHandler`, `api.DsListRemoteScopes`, `errors.Option`). None of them is referenced by any test (verified via `grep` over all `*_test.go` files). Generated file count drops from 77 to 64. 3. **`template-data.with-expecter` is no longer a valid key:** v3 always generates `EXPECT()`-style expectations — purely additive, no test changes needed. 4. **CLI flags are gone:** `--recursive/--keeptree/--dir/--output/--name` no longer exist; configuration is YAML-only, hence the two new config files. ## Validation **CI equivalent (all green):** the identical job matrix was run in a fork workflow (`fork-ci.yml`) on `ci/wave4e` (this branch, unchanged) — [run 30904038830](https://github.com/DoDiODev/devlake/actions/runs/30904038830), **8/8 jobs successful**: builder image, lint (go), unit-test, e2e (mysql), migration-script-lint, config-ui, ASF license header, grafana dashboards. Additionally, locally on macOS (arm64), against the **unmodified** `upstream/main` toolchain (git2go v33 / libgit2 1.3.x — this PR does not touch that pairing, see "Out of scope"): - ✅ `make mock` — regenerates all 64 mock files cleanly (`rm -rf mocks` + both configs in order) - ✅ `go build ./...` — compiles - ✅ `./scripts/unit-test-go.sh` — 64 packages, exit 0, no failures - ✅ `make migration-script-lint` ## Out of scope on purpose - `backend/plugins/gitextractor` / libgit2 / git2go pinning — unrelated, covered by the separate #9028 (Welle 4d). - Any change to `backend/mocks/**` — untracked, not part of the diff. ## Rollback Revert the four version hunks, delete the two `.mockery.*.yml` files, restore the `mock` target's v2 CLI flags. No runtime, schema, or API impact — `backend/mocks/` is generated and untracked either way. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
