Skip to content

add register Origins endpoint#185

Merged
mgoetzegb merged 2 commits intomainfrom
VTI-alert-preparation
Feb 12, 2026
Merged

add register Origins endpoint#185
mgoetzegb merged 2 commits intomainfrom
VTI-alert-preparation

Conversation

@mgoetzegb
Copy link
Copy Markdown
Member

@mgoetzegb mgoetzegb commented Feb 3, 2026

What

Add register Origins endpoint, also split property originUri into originClass and originResourceID

In the future every notification sent to the notification service must have the property originClass set. This property will be used for the alert rules, where a notification from a specific origin (class) and level (info, warning,...) is forwarded to e.g. a mattermost channel.

Note: For now originClass remains optional, to give client time to adjust, it will be made mandatory at a later point of time. Therefore this is not a breaking change so far. The effect of not setting originClass is that no rule will match such a notification (which is not yet implemented anyways so far).

Why

Preparation for the alert feature.

References

VTI-785

Related Client change: greenbone/opensight-golang-libraries#284

Checklist

  • Tests

@mgoetzegb mgoetzegb requested review from a team as code owners February 3, 2026 14:52
@mgoetzegb mgoetzegb added the alpha release Set label to create an alpha pre release label Feb 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 3, 2026

Conventional Commits Report

Type Number
Added 1
Changed 1

🚀 Conventional commits found.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 28.88889% with 192 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.65%. Comparing base (8aaf1c2) to head (03672d3).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...g/services/originservice/mocks/OriginRepository.go 0.00% 77 Missing ⚠️
pkg/web/origincontroller/mocks/OriginService.go 0.00% 77 Missing ⚠️
...kg/repository/originrepository/originRepository.go 72.09% 6 Missing and 6 partials ⚠️
pkg/web/testhelper/helper.go 0.00% 8 Missing ⚠️
pkg/models/origin.go 0.00% 7 Missing ⚠️
pkg/services/originservice/originService.go 0.00% 6 Missing ⚠️
cmd/notification-service/main.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
+ Coverage   20.17%   20.65%   +0.48%     
==========================================
  Files          64       71       +7     
  Lines        2701     2943     +242     
==========================================
+ Hits          545      608      +63     
- Misses       2109     2282     +173     
- Partials       47       53       +6     
Flag Coverage Δ
unit-tests 20.65% <28.88%> (+0.48%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread pkg/repository/originrepository/origin_db_models.go Outdated
Comment thread pkg/repository/originrepository/originRepository.go Outdated
Comment thread pkg/web/origincontroller/originController_test.go
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/models/origin.go Outdated
Copy link
Copy Markdown
Member Author

@mgoetzegb mgoetzegb left a comment

Choose a reason for hiding this comment

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

addressed all comments

Comment thread pkg/models/origin.go Outdated
Comment thread pkg/repository/originrepository/originRepository.go Outdated
Comment thread pkg/repository/originrepository/origin_db_models.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController_test.go
@mgoetzegb mgoetzegb requested a review from llugin February 5, 2026 14:39
llugin
llugin previously approved these changes Feb 5, 2026
Comment thread pkg/models/notification.go
Comment thread pkg/repository/migrations/000004_change_to_origin_class.up.sql
Comment thread pkg/repository/migrations/000004_add_origins_table.up.sql Outdated
Comment thread pkg/repository/originrepository/originRepository.go
mgoetzegb added a commit to greenbone/opensight-golang-libraries that referenced this pull request Feb 6, 2026
… and `OriginResourceID` (#284)

In the notification rules we want filter/match by a class of
notification. But we also want to be able to pinpoint to a specific
event instance in the notification (center). So far we had this
information combined in the OriginUri, but it is more structured if we
have to separate fields rather than needing to split up the value of
OriginUri.

## References

VTI-785

Adjustment in Notification Service:
greenbone/opensight-notification-service#185
Copy link
Copy Markdown
Member Author

@mgoetzegb mgoetzegb left a comment

Choose a reason for hiding this comment

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

I addressed all the comments.

In the course of the review changes I realized that the naming was not good. namespace is not really a namespace, as we expect the origin class by itself to be globally unique. The property only exists for easier grouping and replacement of the origins.

Therefore I renamed namespace to serviceID (aa68b1e) and enforce uniqueness on database levels (3b15aca), so that there is immediate feedback for the caller.

Comment thread pkg/repository/migrations/000004_change_to_origin_class.up.sql
Comment thread pkg/models/notification.go
Comment thread pkg/repository/migrations/000004_add_origins_table.up.sql Outdated
Comment thread pkg/repository/originrepository/originRepository.go
@efernasier efernasier force-pushed the VTI-alert-preparation branch from 3b15aca to 87be8e3 Compare February 9, 2026 08:53
efernasier
efernasier previously approved these changes Feb 9, 2026
@mgoetzegb mgoetzegb force-pushed the VTI-alert-preparation branch from 87be8e3 to 5afbada Compare February 9, 2026 10:31
@mgoetzegb mgoetzegb enabled auto-merge February 9, 2026 10:32
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/repository/originrepository/originRepository.go Outdated
Comment thread pkg/repository/originrepository/originRepository_test.go Outdated
Comment thread pkg/web/origincontroller/originController_test.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Copy link
Copy Markdown
Member Author

@mgoetzegb mgoetzegb left a comment

Choose a reason for hiding this comment

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

thanks for the review 👍, added all requested changes

Comment thread pkg/repository/originrepository/originRepository.go Outdated
Comment thread pkg/repository/originrepository/originRepository_test.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
Comment thread pkg/web/origincontroller/originController_test.go Outdated
Comment thread pkg/web/origincontroller/originController.go Outdated
@mgoetzegb mgoetzegb force-pushed the VTI-alert-preparation branch from 2743277 to 1b0b89d Compare February 11, 2026 13:35
@mgoetzegb mgoetzegb force-pushed the VTI-alert-preparation branch from 1b0b89d to f07f591 Compare February 11, 2026 13:38
@mgoetzegb
Copy link
Copy Markdown
Member Author

fixed conflicts with recently merged branch

@mgoetzegb mgoetzegb force-pushed the VTI-alert-preparation branch from f07f591 to 03672d3 Compare February 12, 2026 12:36
@mgoetzegb mgoetzegb enabled auto-merge February 12, 2026 12:37
@mgoetzegb mgoetzegb merged commit 7259524 into main Feb 12, 2026
15 checks passed
@mgoetzegb mgoetzegb deleted the VTI-alert-preparation branch February 12, 2026 12:38
mgoetzegb added a commit to greenbone/opensight-golang-libraries that referenced this pull request Feb 16, 2026
Allow conveniently calling the newly added endpoint
(greenbone/opensight-notification-service#185).

Each service using the notification service is supposed to register its
used (classes of) origins once on service startup.

## References

VTI-785
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alpha release Set label to create an alpha pre release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants