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

Executable capability registration logic update to match that of trigger capability plus expand test suite to test behaviour #15593

Closed
wants to merge 2 commits into from

Conversation

ettec
Copy link
Collaborator

@ettec ettec commented Dec 10, 2024

Reuse the registration logic from trigger capabiliies in executable capabilties and expand the test cases to contain workflow/capability node bouncing and registration tests to ensure registration logic behaves as expected.

https://smartcontract-it.atlassian.net/browse/CAPPL-314

depends on

Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

🎖️ No JIRA issue number found in: PR title, commit message, or branch name. Please include the issue ID in one of these.

Copy link
Contributor

github-actions bot commented Dec 10, 2024

AER Report: CI Core

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

1. GolangCI Lint failed due to typechecking error and permission denied

[A 1 <= 10 words sentence that describes the error]:[job id where the error happened]

Source of Error:
Golang Lint ()	2024-12-18T19:51:43.5438824Z level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix / does not contain main module or its selected dependencies"
Golang Lint ()	2024-12-18T19:51:43.5440257Z level=error msg="Running error: can't create output for golangci-lint-report.xml: open golangci-lint-report.xml: permission denied"
Golang Lint ()	2024-12-18T19:51:43.5474725Z ##[error]golangci-lint exit with code 3

Why: The GolangCI Lint action failed because it could not find the main module or its dependencies in the root directory (/). Additionally, it encountered a permission denied error when trying to create the golangci-lint-report.xml file.

Suggested fix: Ensure that the working directory is correctly set to the directory containing the go.mod file. Also, check and adjust file permissions to allow the creation of the golangci-lint-report.xml file.

2. Cat command failed due to missing file

[A 1 <= 10 words sentence that describes the error]:[job id where the error happened]

Source of Error:
Golang Lint ()	2024-12-18T19:51:43.5584137Z ##[group]Run cat .//golangci-lint-report.xml
Golang Lint ()	2024-12-18T19:51:43.5584636Z �[36;1mcat .//golangci-lint-report.xml�[0m
Golang Lint ()	2024-12-18T19:51:43.5687336Z cat: .//golangci-lint-report.xml: No such file or directory
Golang Lint ()	2024-12-18T19:51:43.5693336Z ##[error]Process completed with exit code 1.

Why: The cat command failed because the golangci-lint-report.xml file was not created due to the previous permission denied error.

Suggested fix: Fix the permission issue and ensure the golangci-lint-report.xml file is created successfully before attempting to read it with cat.

3. Upload artifact failed due to missing file

[A 1 <= 10 words sentence that describes the error]:[job id where the error happened]

Source of Error:
Golang Lint ()	2024-12-18T19:51:43.5882247Z ##[group]Run actions/[email protected]
Golang Lint ()	2024-12-18T19:51:43.5882738Z with:
Golang Lint ()	2024-12-18T19:51:43.5883040Z name: golangci-lint-report-
Golang Lint ()	2024-12-18T19:51:43.5883428Z path: .//golangci-lint-report.xml
Golang Lint ()	2024-12-18T19:51:43.8408851Z ##[warning]No files were found with the provided path: .//golangci-lint-report.xml. No artifacts will be uploaded.

Why: The artifact upload step failed because the golangci-lint-report.xml file was not found, likely due to the previous permission denied error preventing its creation.

Suggested fix: Resolve the permission issue to ensure the golangci-lint-report.xml file is created, then verify the file path is correct before attempting to upload the artifact.

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@ettec ettec marked this pull request as ready for review December 10, 2024 11:34
@ettec ettec requested review from a team as code owners December 10, 2024 11:34
@ettec ettec requested a review from ilija42 December 10, 2024 11:34
@ettec ettec added the build-publish Build and Publish image to SDLC label Dec 16, 2024
@ettec ettec force-pushed the register-to-workflow branch 2 times, most recently from 8236209 to 9bb5804 Compare December 16, 2024 21:01
Copy link
Contributor

@bolekk bolekk left a comment

Choose a reason for hiding this comment

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

relayed some high-level comments offline

core/capabilities/remote/trigger_subscriber.go Outdated Show resolved Hide resolved
@ettec ettec force-pushed the register-to-workflow branch from 775a25b to 3b27019 Compare December 18, 2024 19:40
"github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types"
"github.com/smartcontractkit/chainlink/v2/core/logger"
p2ptypes "github.com/smartcontractkit/chainlink/v2/core/services/p2p/types"
)

const (
defaultSendChannelBufferSize = 1000
Copy link
Contributor

Choose a reason for hiding this comment

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

why not keep consts together like they were before?

s.wg.Add(1)
err := s.registrationClient.Start(ctx)
if err != nil {
return fmt.Errorf("failed to start capability register: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

"capability register" -> "capability registration client"

@@ -106,78 +106,58 @@ func (s *triggerSubscriber) Info(ctx context.Context) (commoncap.CapabilityInfo,
}

func (s *triggerSubscriber) RegisterTrigger(ctx context.Context, request commoncap.TriggerRegistrationRequest) (<-chan commoncap.TriggerResponse, error) {
s.mu.Lock()
defer s.mu.Unlock()

rawRequest, err := pb.MarshalTriggerRegistrationRequest(request)
if err != nil {
return nil, err
}
if request.Metadata.WorkflowID == "" {
return nil, errors.New("empty workflowID")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Lock() was here before on purpose - we don't have to unmarshal the request under lock

Copy link
Contributor

Choose a reason for hiding this comment

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

If you can, maybe send out a fix for the race condition in a separate PR, so those two independent changes are not bundled together.

registration, found := s.registeredWorkflows[workflowID]
s.mu.RUnlock()
if !found {
registered := s.isWorkflowRegistered(workflowID)
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the "registered" variable, just if !s.isWorkflow...

// Registrations will quickly expire on all remote nodes.
// Alternatively, we could send UnregisterTrigger messages right away.

responseChannel <- response
Copy link
Contributor

Choose a reason for hiding this comment

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

We do this under a lock - what if the reader is slow? It will block the whole subscriber object.

// unregister messages to the nodes
}

func (r *Client) registrationLoop() {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is pretty much the same as the current registrationLoop() in triggerSubscriber, right?

registrationRequest []byte
}

type registerDispatcher interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to just use the types.Dispatcher interface. Is there some unexpected circular dependency?


registrationServer := registration.NewServer(lggr, publisher, capInfo, config.RegistrationExpiry, workflowDONs, "TriggerPublisher")

publisher.registrationServer = registrationServer
Copy link
Contributor

Choose a reason for hiding this comment

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

just put those two lines above object creation and return it like it was before - why make an exception for this one field?

r.lggr.Errorw("invalid message id", "err", err, "id", remote.SanitizeLogString(string(msg.MessageId)))
return
}
req, err := pb.UnmarshalRegisterToWorkflowRequest(msg.Payload)
Copy link
Contributor

Choose a reason for hiding this comment

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

Some tabs vs spaces problem here?

@ettec ettec closed this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-publish Build and Publish image to SDLC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants