Skip to content

PMM-15129 Fix revive Go linter issues (p2)#5586

Merged
maxkondr merged 26 commits into
mainfrom
PMM-15129-fix-go-linter-revive-p2
Jul 3, 2026
Merged

PMM-15129 Fix revive Go linter issues (p2)#5586
maxkondr merged 26 commits into
mainfrom
PMM-15129-fix-go-linter-revive-p2

Conversation

@maxkondr

@maxkondr maxkondr commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Ticket number: PMM-15129

Feature build: Percona-Lab/pmm-submodules#4452

This pull request primarily refactors code for improved consistency and clarity by standardizing naming conventions and updating import paths across several MongoDB agent components and the supervisor module.

Naming and Import Refactoring

  • Replaced all occurrences of the import path github.com/percona/pmm/agent/utils/mongo_fix with github.com/percona/pmm/agent/utils/mongofix in MongoDB agent files and related tests to match the new package naming convention. (mongolog/internal/mongolog.go, profiler/internal/collector/collector_test.go, profiler/internal/profiler.go, realtimeanalytics/connection.go, shared/fingerprinter/fingerprinter_test.go) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

  • Updated all usages of the mongo_fix identifier to mongofix for the ClientOptionsForDSN function to align with the updated import. [1] [2] [3] [4] [5]

Supervisor Module Improvements

  • Renamed test agent type constants from type_TEST_SLEEP and type_TEST_NOOP to typeTestSleep and typeTestNoop, and updated all references throughout supervisor.go and supervisor_test.go for consistency with Go naming conventions. [1] [2] [3] [4] [5] [6] [7] [8] [9]

  • Refactored variable names in supervisor.go from process_Retry_Time and start_Process_Waiting to processRetryTime and startProcessWaiting for improved readability and code style. [1] [2]

  • Renamed the local variable process to processWrapper in startProcess to avoid confusion with the package name and improve code clarity. [1] [2] [3]

These changes do not alter functionality but improve maintainability and code quality.

maxkondr and others added 16 commits June 29, 2026 18:46
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.30769% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.64%. Comparing base (bdef9d2) to head (2d8bd1b).

Files with missing lines Patch % Lines
...naged/services/management/backup/backup_service.go 33.33% 4 Missing ⚠️
managed/services/server/server.go 50.00% 4 Missing ⚠️
managed/utils/validators/validators.go 0.00% 3 Missing ⚠️
managed/services/management/grpc/actions_server.go 0.00% 2 Missing ⚠️
.../services/telemetry/datasource_grafanadb_select.go 0.00% 2 Missing ⚠️
...aged/services/telemetry/datasource_pmmdb_select.go 0.00% 2 Missing ⚠️
...aged/services/telemetry/datasource_qandb_select.go 0.00% 2 Missing ⚠️
.../services/telemetry/datasource_victoria_metrics.go 0.00% 2 Missing ⚠️
agent/agents/mongodb/mongolog/internal/mongolog.go 0.00% 1 Missing ⚠️
...ent/agents/mongodb/realtimeanalytics/connection.go 0.00% 1 Missing ⚠️
... and 7 more
Additional details and impacted files
@@                          Coverage Diff                          @@
##           PMM-15129-fix-go-linter-revive-p1    #5586      +/-   ##
=====================================================================
+ Coverage                              43.60%   43.64%   +0.04%     
=====================================================================
  Files                                    414      414              
  Lines                                  43057    43058       +1     
=====================================================================
+ Hits                                   18775    18793      +18     
+ Misses                                 22404    22390      -14     
+ Partials                                1878     1875       -3     
Flag Coverage Δ
admin 34.78% <ø> (ø)
agent 49.04% <66.66%> (+0.12%) ⬆️
managed 43.05% <21.42%> (+0.01%) ⬆️
vmproxy 72.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the PMM-15129 effort to address Go linter (revive) findings by removing now-unneeded suppressions, tightening naming/unused-parameter patterns, and improving clarity around a few agent/server behaviors (notably MySQL explain action errors and DB calls with context).

Changes:

  • Replaces several //nolint:revive usages with either proper documentation comments or unused-parameter elision.
  • Refactors MySQL EXPLAIN action errors into sentinel error variables and updates related tests accordingly.
  • Improves server-side DB access patterns by threading request contexts into reform queries (WithContext(ctx)).

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
version/features.go Simplifies feature minimum-version definitions (now inline parsing).
utils/sqlmetrics/sqlmetrics.go Replaces revive suppressions with proper exported-method doc comments.
utils/logger/grpc.go Removes unused parameter name from V to satisfy linters.
qan-api2/utils/logger/grpc.go Same V signature cleanup for qan-api2 logger wrapper.
managed/utils/validators/validators.go Removes unnecessary revive suppressions on exported constants.
managed/services/telemetry/datasource_victoria_metrics.go Drops unused ctx parameter names in Init/Dispose.
managed/services/telemetry/datasource_qandb_select.go Drops unused ctx parameter names in Init/Dispose.
managed/services/telemetry/datasource_pmmdb_select.go Drops unused ctx parameter names in Init/Dispose.
managed/services/telemetry/datasource_grafanadb_select.go Drops unused ctx parameter names in Init/Dispose.
managed/services/server/server.go Removes revive suppressions; uses request context in DB calls.
managed/services/management/grpc/actions_server.go Uses context-aware DB querier for model lookups.
managed/services/management/backup/backup_service.go Uses context-aware DB querier; removes unused request parameter.
managed/services/inventory/grpc/services_server.go Removes unused request parameter name to satisfy linter.
managed/services/ha/leaderservice_test.go Fixes context.WithValue key typing to satisfy staticcheck/revive.
managed/services/backup/pitr_timerange_service.go Replaces += 1 with ++ per revive preference.
managed/services/agents/channel/channel.go Adds documentation to the Stream interface instead of suppressing revive.
managed/pi/common/severity.go Adds a proper package comment (removing revive suppression).
agent/utils/mongo_fix/mongo_fix.go Removes revive suppression from package declaration.
agent/utils/mongo_fix/mongo_fix_test.go Removes revive suppression from package declaration in tests.
agent/utils/backoff/backoff_test.go Removes unused test parameter name.
agent/runner/runner_test.go Removes unused parameter name in test job’s Run.
agent/runner/jobs/pbm_helpers.go Simplifies control flow by removing unnecessary else.
agent/runner/actions/mysql_explain_action.go Introduces sentinel errors for EXPLAIN action validation failures.
agent/runner/actions/mysql_explain_action_test.go Updates assertions to use require.ErrorIs for sentinel errors.
agent/config/logger.go Removes unused parameter name in gRPC logger wrapper V.
agent/commands/setup.go Removes unnecessary revive suppression from file-level nolint.
agent/client/token_auth.go Removes unused parameter names from credential metadata method.
agent/client/basic_auth.go Removes unused parameter names from credential metadata method.
agent/agents/supervisor/supervisor.go Renames constants to match naming conventions; avoids pkg/var name shadowing.
agent/agents/supervisor/supervisor_test.go Updates tests to match renamed supervisor constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent/utils/mongo_fix/mongo_fix.go Outdated
Comment thread agent/utils/mongo_fix/mongo_fix_test.go Outdated
Comment thread version/features.go
Comment thread utils/logger/grpc.go Outdated
Comment thread qan-api2/utils/logger/grpc.go Outdated
Comment thread agent/config/logger.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread managed/utils/validators/validators.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread agent/runner/actions/mysql_explain_action.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 1 comment.

Comment thread agent/agents/supervisor/supervisor.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated no new comments.

@maxkondr
maxkondr marked this pull request as ready for review July 2, 2026 12:59
@maxkondr
maxkondr requested a review from a team as a code owner July 2, 2026 12:59
@maxkondr
maxkondr requested review from 4nte, JiriCtvrtka and ademidoff and removed request for a team July 2, 2026 12:59
@maxkondr maxkondr added the auto-update-branch used by .github/workflows/auto-update-base.yaml label Jul 2, 2026
@maxkondr maxkondr mentioned this pull request Jul 2, 2026
1 task
Comment thread agent/utils/mongofix/mongofix_test.go
Base automatically changed from PMM-15129-fix-go-linter-revive-p1 to main July 3, 2026 09:37
@maxkondr
maxkondr merged commit d4d5ba4 into main Jul 3, 2026
29 checks passed
@maxkondr
maxkondr deleted the PMM-15129-fix-go-linter-revive-p2 branch July 3, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-update-branch used by .github/workflows/auto-update-base.yaml

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants