Skip to content

[o365] Remove redundant filtering logic for non-cursor state#19320

Merged
chrisberkhout merged 3 commits into
elastic:mainfrom
chrisberkhout:o365-simplification
Jun 5, 2026
Merged

[o365] Remove redundant filtering logic for non-cursor state#19320
chrisberkhout merged 3 commits into
elastic:mainfrom
chrisberkhout:o365-simplification

Conversation

@chrisberkhout
Copy link
Copy Markdown
Contributor

@chrisberkhout chrisberkhout commented Jun 1, 2026

Proposed commit message

[o365] Remove redundant filtering logic for non-cursor state

#17540 added logic to filter out data in `state.cursor.todo_links` and
`state.cursor.todo_content` that isn't related to the currently
configured types. That's good. This PR adds an item for that in logic
overview comment at the top.

#17540 added similar filtering of `state.todo_types`, but that is
redundant because each config change or other restart will clear that
data already. This PR reverts that part and adds a comment to clarify.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Related issues

@chrisberkhout chrisberkhout requested review from a team as code owners June 1, 2026 13:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

✅ Elastic Docs Style Checker (Vale)

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.

@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@andrewkroh andrewkroh added Integration:o365 Microsoft Office 365 Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Jun 1, 2026
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

(existing_todo_types.size() > 0) ?
existing_todo_types
:
state.base.content_types.split(",").map(t, t.trim_space())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to make this more robust to user input like type1, , type2 (extra commas, with spaces). The previous code does this incidentally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's good. Added.

@chrisberkhout chrisberkhout force-pushed the o365-simplification branch from 906ea54 to d5382aa Compare June 3, 2026 07:44
@chrisberkhout chrisberkhout requested a review from efd6 June 3, 2026 07:44
(existing_todo_types.size() > 0) ?
existing_todo_types
:
state.base.content_types.split(",").map(t, t.trim_space()).filter(t, size(t) > 0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
state.base.content_types.split(",").map(t, t.trim_space()).filter(t, size(t) > 0)
state.base.content_types.split(",").map(t, t.trim_space() != "", t.trim_space())

rather than making two arrays, and using "" instead of size so that it's clear we're dealing with strings.

Also, will need to regenerate the policy tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@chrisberkhout chrisberkhout force-pushed the o365-simplification branch from d5382aa to d99ad76 Compare June 3, 2026 08:23
@elastic elastic deleted a comment from github-actions Bot Jun 3, 2026
@chrisberkhout chrisberkhout requested a review from efd6 June 3, 2026 08:25
@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

History

@chrisberkhout chrisberkhout merged commit c44b737 into elastic:main Jun 5, 2026
10 checks passed
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

Package o365 - 3.10.1 containing this change is available at https://epr.elastic.co/package/o365/3.10.1/

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

Labels

Integration:o365 Microsoft Office 365 Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants