-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
I see you updated files related to
|
AER Report: CI Coreaer_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:
Why: The GolangCI Lint action failed because it could not find the main module or its dependencies in the root directory ( Suggested fix: Ensure that the working directory is correctly set to the directory containing the 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:
Why: The Suggested fix: Fix the permission issue and ensure the 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:
Why: The artifact upload step failed because the Suggested fix: Resolve the permission issue to ensure the AER Report: Operator UI CI ran successfully ✅ |
8236209
to
9bb5804
Compare
There was a problem hiding this 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
2dc55be
to
7e69460
Compare
eea3387
to
775a25b
Compare
775a25b
to
3b27019
Compare
Quality Gate passedIssues Measures |
"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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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") | |||
} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
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