Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate kslib #15759

Merged
merged 11 commits into from
Dec 20, 2024
Merged

deprecate kslib #15759

merged 11 commits into from
Dec 20, 2024

Conversation

krehermann
Copy link
Contributor

@krehermann krehermann commented Dec 18, 2024

KS-672

First step in refactor the apis to be more ergonomic and coherent

This is a backward compatible code relocation. The follow up steps include refactoring /internal to be less opaque, adding Changesets that port the RegisterXXX funcs, and migrate the downstream callers

More ctx in the epic

Requires

Supports

@krehermann krehermann changed the title logging, edge case fixes remove kslib Dec 18, 2024
Copy link
Contributor

github-actions bot commented Dec 18, 2024

AER Report: CI Core

aer_workflow , commit , Detect Changes , Clean Go Tidy & Generate , Scheduled Run Frequency , Flakeguard Root Project / Get Tests To Run , Core Tests (go_core_tests) , GolangCI Lint (core/scripts) , Core Tests (go_core_tests_integration) , test-scripts , GolangCI Lint (.) , Core Tests (go_core_ccip_deployment_tests) , GolangCI Lint (deployment) , Core Tests (go_core_fuzz) , Core Tests (go_core_race_tests) , Flakeguard Deployment Project / Get Tests To Run , Flakeguard Root Project / Run Tests , Flakeguard Root Project / Report , Flakeguard Deployment Project / Run Tests (github.com/smartcontractkit/chainlink/deployment/keystone/changeset, ubuntu-latest) , Flakeguard Deployment Project / Run Tests (github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal, ubuntu-l... , Flakeguard Deployment Project / Run Tests (github.com/smartcontractkit/chainlink/deployment/keystone/changeset/workflowregistry, ... , lint , SonarQube Scan , Flakey Test Detection , Flakeguard Deployment Project / Report

1. Deprecated comment format error: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.7978326Z ##[error]deployment/keystone/deprecated.go:7:1: deprecatedComment: use `Deprecated: ` (note the casing) instead of `DEPRECATED: ` (gocritic)
Golang Lint (deployment) 2024-12-20T17:42:26.7980151Z // DEPRECATED: Use changeset package instead
Golang Lint (deployment) 2024-12-20T17:42:26.7980573Z ^
Golang Lint (deployment) 2024-12-20T17:42:26.7983016Z ##[error]deployment/keystone/deprecated.go:11:1: deprecatedComment: use `Deprecated: ` (note the casing) instead of `DEPRECATED: ` (gocritic)
Golang Lint (deployment) 2024-12-20T17:42:26.7983952Z // DEPRECATED: Use changeset package instead
Golang Lint (deployment) 2024-12-20T17:42:26.7984365Z ^
Golang Lint (deployment) 2024-12-20T17:42:26.7985721Z ##[error]deployment/keystone/deprecated.go:15:1: deprecatedComment: use `Deprecated: ` (note the casing) instead of `DEPRECATED: ` (gocritic)
Golang Lint (deployment) 2024-12-20T17:42:26.7986651Z // DEPRECATED: Use changeset package instead
Golang Lint (deployment) 2024-12-20T17:42:26.7987050Z ^

Why: The comments in the code use DEPRECATED: instead of the required Deprecated: format, which is enforced by the gocritic linter.

Suggested fix: Update the comments to use Deprecated: instead of DEPRECATED: .

2. File not goimports-ed: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.7987986Z deployment/keystone/changeset/workflowregistry/setup_test.go:5: File is not `goimports`-ed with -local github.com/smartcontractkit/chainlink (goimports)

Why: The file setup_test.go is not formatted according to goimports standards with the -local flag set to github.com/smartcontractkit/chainlink.

Suggested fix: Run goimports -local github.com/smartcontractkit/chainlink -w deployment/keystone/changeset/workflowregistry/setup_test.go to format the file correctly.

3. Consider pre-allocating slice: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.7990096Z ##[error]deployment/keystone/changeset/internal/test/utils.go:216:2: Consider pre-allocating `out` (prealloc)
Golang Lint (deployment) 2024-12-20T17:42:26.7990950Z 	var out []internal.RegisteredCapability
Golang Lint (deployment) 2024-12-20T17:42:26.7991587Z 	^

Why: The out slice is not pre-allocated, which can lead to inefficient memory usage.

Suggested fix: Pre-allocate the out slice if the size is known beforehand, e.g., var out = make([]internal.RegisteredCapability, 0, expectedSize).

4. Redefinition of built-in function: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.7992882Z ##[error]deployment/keystone/changeset/internal/test/utils.go:185:37: redefines-builtin-id: redefinition of the built-in function cap (revive)
Golang Lint (deployment) 2024-12-20T17:42:26.7994155Z func defaultCapConfig(t *testing.T, cap capabilities_registry.CapabilitiesRegistryCapability) []byte {
Golang Lint (deployment) 2024-12-20T17:42:26.7995101Z ^
Golang Lint (deployment) 2024-12-20T17:42:26.7996452Z ##[error]deployment/keystone/changeset/internal/test/utils.go:206:32: redefines-builtin-id: redefinition of the built-in function cap (revive)
Golang Lint (deployment) 2024-12-20T17:42:26.7997743Z func (cc *CapabilityCache) Get(cap capabilities_registry.CapabilitiesRegistryCapability) ([32]byte, bool) {
Golang Lint (deployment) 2024-12-20T17:42:26.7998672Z ^

Why: The identifier cap is used, which conflicts with the built-in function cap.

Suggested fix: Rename the cap parameter to something else, such as capability.

5. Variable naming convention: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.7999912Z ##[error]deployment/keystone/changeset/internal/test/utils.go:272:6: var-naming: func capabilityIds should be capabilityIDs (revive)
Golang Lint (deployment) 2024-12-20T17:42:26.8001492Z func capabilityIds(registry *capabilities_registry.CapabilitiesRegistry, rcs []internal.RegisteredCapability) ([][32]byte, error) {
Golang Lint (deployment) 2024-12-20T17:42:26.8002398Z ^
Golang Lint (deployment) 2024-12-20T17:42:26.8003650Z ##[error]deployment/keystone/changeset/internal/test/utils.go:284:6: var-naming: func mustCapabilityIds should be mustCapabilityIDs (revive)
Golang Lint (deployment) 2024-12-20T17:42:26.8005101Z func mustCapabilityIds(t *testing.T, registry *capabilities_registry.CapabilitiesRegistry, rcs []internal.RegisteredCapability) [][32]byte {
Golang Lint (deployment) 2024-12-20T17:42:26.8005982Z ^

Why: The function names capabilityIds and mustCapabilityIds do not follow the camel case naming convention.

Suggested fix: Rename the functions to capabilityIDs and mustCapabilityIDs.

6. Unnecessary leading newline: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.8007422Z ##[error]deployment/keystone/changeset/workflowregistry/workflow_registry_deployer.go:32:108: unnecessary leading newline (whitespace)
Golang Lint (deployment) 2024-12-20T17:42:26.8008206Z 
Golang Lint (deployment) 2024-12-20T17:42:26.8008364Z ^

Why: There is an unnecessary leading newline in the code.

Suggested fix: Remove the unnecessary newline.

7. Ineffectual assignment to err: Golang Lint (deployment)

Source of Error:
Golang Lint (deployment) 2024-12-20T17:42:26.8009455Z ##[error]deployment/keystone/changeset/workflowregistry/workflow_registry_deployer.go:66:12: ineffectual assignment to err (ineffassign)
Golang Lint (deployment) 2024-12-20T17:42:26.8010462Z 	deployer, err := newWorkflowRegistryDeployer()
Golang Lint (deployment) 2024-12-20T17:42:26.8010936Z 	 ^

Why: The variable err is assigned but never used.

Suggested fix: Use the err variable or remove the assignment if it is not needed.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 73b8fb8 (ks/deprecate-kslib).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestAcceptAllOwnership 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/keystone/changeset false 653.333333ms @smartcontractkit/keystone, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_configureOCR3Request_generateOCR3Config 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal false 0s @smartcontractkit/keystone, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 9537fbe (ks/deprecate-kslib).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestAcceptAllOwnership 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/keystone/changeset false 620ms @smartcontractkit/keystone, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_configureOCR3Request_generateOCR3Config 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal false 0s @smartcontractkit/keystone, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

@krehermann krehermann force-pushed the ks/deprecate-kslib branch 2 times, most recently from 81f2c5d to 34ab33a Compare December 20, 2024 16:01
Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 34ab33a (ks/deprecate-kslib).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
Test_configureOCR3Request_generateOCR3Config 0.00% false false false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal false 0s @smartcontractkit/keystone, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

@smartcontractkit smartcontractkit deleted a comment from github-actions bot Dec 20, 2024
@smartcontractkit smartcontractkit deleted a comment from github-actions bot Dec 20, 2024
@krehermann krehermann marked this pull request as ready for review December 20, 2024 17:23
@krehermann krehermann requested review from a team as code owners December 20, 2024 17:23
@krehermann krehermann changed the title remove kslib deprecate kslib Dec 20, 2024
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)
11 New Major Issues (required ≤ 5)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

@krehermann krehermann enabled auto-merge December 20, 2024 18:40
@krehermann krehermann added this pull request to the merge queue Dec 20, 2024
Merged via the queue into develop with commit 0b8172d Dec 20, 2024
172 of 174 checks passed
@krehermann krehermann deleted the ks/deprecate-kslib branch December 20, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants