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

Various event-related fixes and improvements #2565

Merged

Conversation

rvolosatovs
Copy link
Contributor

@rvolosatovs rvolosatovs commented May 18, 2020

Summary

References https://github.com/TheThingsIndustries/lorawan-stack/pull/2096
Close #2569

Changes

  • Fix rightsutil.EventIsVisible
  • Avoid mutating proto when decoding
  • Remove event stream start/end events, because they do not seem necessary, please let me know if and why we would need them. When we have the historical data as well, these won't make any sense at all IMO.
  • Introduce test.AllTrue and use in NS

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md. The target branch is set to master if the changes are fully compatible with existing API, database, configuration and CLI.
  • Testing: The changes are covered with unit tests. The changes are tested manually as well.
  • Documentation: Relevant documentation is added or updated.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@rvolosatovs rvolosatovs added the blocking Another issue or pull request is waiting for this label May 18, 2020
@rvolosatovs rvolosatovs added this to the May 2020 milestone May 18, 2020
@rvolosatovs rvolosatovs self-assigned this May 18, 2020
@rvolosatovs rvolosatovs force-pushed the feature/various-event-related branch from 6ff505d to 24233f4 Compare May 18, 2020 17:30
@rvolosatovs
Copy link
Contributor Author

@rvolosatovs rvolosatovs added the bump/minor Needs new minor version for release label May 18, 2020
@rvolosatovs rvolosatovs added the c/shared This is shared between components label May 18, 2020
Copy link
Member

@johanstokking johanstokking left a comment

Choose a reason for hiding this comment

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

Passes sanity check, but needs @htdvisser approval as he may have had some ideas around event start/stop and API behavior

if len(req.Identifiers) == 0 {
return nil
return errNoIdentifiers
Copy link
Member

Choose a reason for hiding this comment

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

This is an API behavioral change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't this fall under these two:

  1. We will not break the API between components and events within minor versions. So at least the same minor versions of components are compatible with each other.
  2. We reserve the right to fix bugs in API, configuration and storage in patches and minor updates. This may break components, gateways and applications that rely on buggy behavior.

IMO silently failing here is a bug

Copy link
Member

Choose a reason for hiding this comment

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

I don't see a bug report that is referenced

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rvolosatovs rvolosatovs added the compat/api This could affect API compatibility label May 19, 2020
@rvolosatovs rvolosatovs added the bug Something isn't working label May 19, 2020
@@ -45,7 +45,6 @@ func unmarshalContext(ctx context.Context, data map[string][]byte) (context.Cont
if err != nil {
return nil, err
}
delete(data, name)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change makes that unmarshalContext and marshalContext are no longer symmetric. Not sure if that was intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed that

for _, entityIDs := range evt.Identifiers() {
// EventIsVisible returns whether ev is visible given rights in the context.
func EventIsVisible(ctx context.Context, ev events.Event) (bool, error) {
visibility := ev.Visibility().Implied()
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 not correct in this context.

Maybe Implied() is a bit confusing. If a user has the "admin right", that implies that the user has all rights. If an event is visible to callers with the "admin right", that doesn't mean it's also visible to the implicit rights (i.e. for a caller with only the "info right").

@rvolosatovs rvolosatovs force-pushed the feature/various-event-related branch 2 times, most recently from 67bc32f to 9c2e8a1 Compare May 20, 2020 15:58
Copy link
Member

@johanstokking johanstokking left a comment

Choose a reason for hiding this comment

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

Code owned files LGTM

@rvolosatovs rvolosatovs merged commit 8fae991 into TheThingsNetwork:develop May 25, 2020
@rvolosatovs rvolosatovs deleted the feature/various-event-related branch May 25, 2020 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocking Another issue or pull request is waiting for this bug Something isn't working bump/minor Needs new minor version for release c/shared This is shared between components compat/api This could affect API compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Event streaming endpoint silently fails when no identifiers specified
3 participants