Skip to content

ES-2944 - use this (self) instead of bound ls#221

Open
jgrantr wants to merge 1 commit intomasterfrom
feature/ES-2944-use-this-instead-of-bound-ls
Open

ES-2944 - use this (self) instead of bound ls#221
jgrantr wants to merge 1 commit intomasterfrom
feature/ES-2944-use-this-instead-of-bound-ls

Conversation

@jgrantr
Copy link
Copy Markdown
Contributor

@jgrantr jgrantr commented Apr 2, 2026

  • To make mocking things for unit tests easier, change the functions (that were already function and not arrow functions) to use this instead of ls. This allows us to easily mock the functions that send the data to S3 or various other places without having to re-implement the streams module.
  • ensured the unit tests all passed before and after (with sufficient coverage)
  • only test modified was one from the mock SDK, none that exercise the real pipelines

Note

Medium Risk
Touches core stream pipeline assembly (load/enrich/offload and putEvent) and changes method binding semantics, which could break callers that relied on the previous closure-bound ls behavior or unbound function references.

Overview
Refactors leo-stream.js pipeline builders (load, enrich, offload, and putEvent) to use this (captured as self) instead of the closed-over ls, so overridden stream methods are honored during runtime and testing.

Updates the public SDK (index.js) to bind load/enrich/offload to the underlying stream instance, and simplifies lib/mock-sdk.ts by deleting the custom enrich/offload reimplementations and explicitly binding mock enrich/offload so this resolves to mockStreams (plus a small unit test adjustment around disableS3: false).

Written by Cursor Bugbot for commit 788894a. This will update automatically on new commits. Configure here.

- To make mocking things for unit test easier, change the functions (that were already `function` and not arrow functions) to use `this` instead of `ls`. This allows us to easily mock the functions that send the data to S3 or various other places without having to re-implement the streams module.
- ensured the unit tests all passed before and after
- only test modified was one from the mock SDK, none that exercise the real pipelines
@ch-snyk-sa
Copy link
Copy Markdown

ch-snyk-sa commented Apr 2, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

3 participants