Skip to content

feat(feeds): remove stream ID lookup when approving data streams jobs#22508

Open
jkongie wants to merge 1 commit into
developfrom
OPDATA-5937/remove-data-streams-auto-delete
Open

feat(feeds): remove stream ID lookup when approving data streams jobs#22508
jkongie wants to merge 1 commit into
developfrom
OPDATA-5937/remove-data-streams-auto-delete

Conversation

@jkongie
Copy link
Copy Markdown
Contributor

@jkongie jkongie commented May 18, 2026

Match data streams (job.Stream) specs only by external job ID when approving job proposals, the same as CRESettings and CCV job types. Previously, a stream spec with a different external job ID but the same stream ID as a running job would trigger the force-replace path (delete + recreate). That auto-delete behavior is now removed; stream job uniqueness is determined exclusively by external job ID.

OPDATA-5937

@github-actions
Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

✅ No conflicts with other open PRs targeting develop

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented May 18, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@jkongie jkongie marked this pull request as ready for review May 18, 2026 16:05
@jkongie jkongie requested a review from a team as a code owner May 18, 2026 16:05
Copilot AI review requested due to automatic review settings May 18, 2026 16:05
@jkongie jkongie requested review from a team as code owners May 18, 2026 16:05
Copy link
Copy Markdown
Contributor

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

Risk Rating: MEDIUM

Adjusts feeds job-proposal approval behavior for data streams so stream jobs are matched solely by externalJobID (removing the prior stream-ID-based “force replace” path), aligning streams with other job types that are only matchable by external job ID.

Changes:

  • Removed FindJobIDByStreamID from the job ORM interface/implementation and its generated mock.
  • Updated ApproveSpec to no longer look up existing stream jobs by streamID (external job ID only).
  • Updated stream approval tests to stop expecting stream-ID lookups and to cover the “same streamID, different external job ID” approval scenario.

Targeted areas needing scrupulous human review:

  • core/services/feeds/service.go approval/force-replace logic for job.Stream, especially compatibility with existing DB constraints on jobs.stream_id and the resulting runtime behavior on collisions.

Reviewed changes

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

File Description
core/services/job/orm.go Removes stream-ID lookup API from job ORM.
core/services/job/mocks/orm.go Updates generated job ORM mock to match interface changes.
core/services/feeds/service.go Stops stream job collision checks by stream ID during approval.
core/services/feeds/service_test.go Updates/reshapes stream approval tests to reflect new matching behavior.
Files not reviewed (1)
  • core/services/job/mocks/orm.go: Language not supported
Comments suppressed due to low confidence (2)

core/services/feeds/service_test.go:4046

  • Same issue here: GetSpec is called with only (ctx, id) in production code, but this expectation includes an extra argument and won't match at runtime. Update the mock expectation to only include ctx and the spec ID.

				svc.orm.On("GetSpec", mock.Anything, cancelledSpec.ID, mock.Anything).Return(cancelledSpec, nil)
				svc.orm.On("GetJobProposal", mock.Anything, jp.ID).Return(jp, nil)
				svc.orm.On("ListSpecsByJobProposalIDs", mock.Anything, []int64{cancelledSpec.JobProposalID}).

core/services/feeds/service_test.go:4057

  • Same mismatch again: this GetSpec expectation supplies 3 arguments, but the real GetSpec(ctx, id) call supplies 2. This will cause a testify/mock unexpected-call failure when the test runs.
			before: func(svc *TestService) {
				svc.orm.On("GetSpec", mock.Anything, cancelledSpec.ID, mock.Anything).Return(rejectedSpec, nil)
				svc.orm.On("GetJobProposal", mock.Anything, jp.ID).Return(jp, nil)

Comment on lines +1063 to +1064
case job.CRESettings,
job.Stream,
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.

@jkongie This one seems relevant

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.

This is what we want to happen though.

The logic is determined by the Data Streams team on what they allow the node to run.

Am I missing something with this?

Comment thread core/services/feeds/service_test.go Outdated
Match data streams (job.Stream) specs only by external job ID when
approving job proposals, the same as CRESettings and CCV job types.
Previously, a stream spec with a different external job ID but the
same stream ID as a running job would trigger the force-replace path
(delete + recreate). That auto-delete behavior is now removed; stream
job uniqueness is determined exclusively by external job ID.

OPDATA-5937
@jkongie jkongie force-pushed the OPDATA-5937/remove-data-streams-auto-delete branch from 4ae592d to 12e3a53 Compare May 20, 2026 08:04
@cl-sonarqube-production
Copy link
Copy Markdown

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