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

Fix emitting non-exact out selectors. #801

Merged
merged 3 commits into from
Sep 11, 2024
Merged

Fix emitting non-exact out selectors. #801

merged 3 commits into from
Sep 11, 2024

Conversation

3asm
Copy link
Member

@3asm 3asm commented Sep 11, 2024

out-selectors enable a hierarchical logic to receive and emit messages. If an agent list listens to v3.report then he will receive all messages like v3.report, v3.report.vulnerability, v3.report.xxx.

If an agent states out-selector, he should in the same fashion be able to emit all sub-messages.

The current implementation was doing an exact match:

ostorlab.agent.agent.NonListedMessageSelectorError

Fix switch to startswith check:

        if (
            any(
                out_selector.startswith(selector) for out_selector in self.out_selectors
            )
            is True
        ):
```.

Unit test checks for both should and should not emit case.

benyissa
benyissa previously approved these changes Sep 11, 2024
amine3
amine3 previously approved these changes Sep 11, 2024
src/ostorlab/agent/agent.py Outdated Show resolved Hide resolved
@3asm 3asm dismissed stale reviews from amine3 and benyissa via 61fa2e9 September 11, 2024 09:09
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 62.73%. Comparing base (f50390c) to head (61fa2e9).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
tests/agent/agent_test.py 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #801      +/-   ##
==========================================
+ Coverage   62.68%   62.73%   +0.04%     
==========================================
  Files         340      340              
  Lines       14210    14229      +19     
==========================================
+ Hits         8907     8926      +19     
  Misses       5303     5303              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@3asm 3asm dismissed mohsinenar’s stale review September 11, 2024 09:22

Comment fixed.

@3asm 3asm merged commit 1d783a5 into main Sep 11, 2024
12 checks passed
@3asm 3asm deleted the fix/emit_parent_selector branch September 11, 2024 09:22
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.

5 participants