Skip to content

Conversation

@tcannon91
Copy link
Contributor

Jira: https://jira.mongodb.org/browse/STREAMS-1136

Users ask for the ability to assign stream processor pipelines to variables so they can more easily reuse and debug them in the shell. While I was in there I figured I would expose all individual attributes on the stream processor.

@tcannon91 tcannon91 requested a review from a team as a code owner November 15, 2025 03:07
Copilot AI review requested due to automatic review settings November 15, 2025 03:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Stream Processor API to allow users to drill into individual stream processor attributes. Previously, stream processors only exposed their name; now they expose all attributes (id, pipeline, state, tier, errorMsg, lastModified, lastStateChange) as individual properties, enabling easier variable assignment and debugging in the shell.

Key changes:

  • Modified StreamProcessor constructor to accept a data object instead of just a name string
  • Updated getProcessor() to pass complete processor data instead of only the name
  • Changed [asPrintable]() to return a complete data object rather than a simple string

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/shell-api/src/streams.ts Updated getProcessor() signature to accept StreamProcessorData object; modified calls to pass complete processor data including pipeline and options
packages/shell-api/src/streams.spec.ts Added comprehensive test coverage for listStreamProcessors() including filter handling, error cases, and property access verification
packages/shell-api/src/stream-processor.ts Refactored constructor to accept data object and expose all processor attributes as public properties; updated [asPrintable]() to return complete processor data

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@addaleax addaleax changed the title STREAMS-1136: Add ability to drill into stream processor attributes feat(shell-api): add ability to drill into stream processor attributes STREAMS-1136 Nov 17, 2025
this.tier = data.tier;
this.errorMsg = data.errorMsg;
this.lastModified = data.lastModified;
this.lastStateChange = data.lastStateChange;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Having this list means we'll need to keep it up to date with the source of truth, which I guess is the server – would there be a major downside to assining all properties of data to this object?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... I kind of hated it. I tried to get this working at one point but was having issues. I tried to stuff everything under a this.data attribute with the type of StreamProcessorData (Document & { name: string }) but I couldn't figure out how to dynamically expose top level getters for all of the attributes (so that users don't have to go through .data. I guess I could just iterate through the keys in the document and assign those values to this 🤔 will get that going :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess I could just iterate through the keys in the document and assign those values to this 🤔 will get that going :)

Yeah, that's more or less what I would have done – there's obviously a small potential for conflicts, but I think that's okay here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know what you think. Seems fairly straightforward to me. But easy to say as the author :)

@tcannon91
Copy link
Contributor Author

The evergreen failures appear to be unrelated

@tcannon91
Copy link
Contributor Author

@addaleax Should be good to merge now. The evergreen failures do not appear to be related to my PR

Copy link
Collaborator

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@addaleax addaleax merged commit f3ff98c into mongodb-js:main Nov 19, 2025
134 of 144 checks passed
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.

2 participants