Skip to content

HMS-9952: Add NewlyAddedErrata job#1537

Open
swadeley wants to merge 4 commits into
content-services:mainfrom
swadeley:swadeley/HMS-9952
Open

HMS-9952: Add NewlyAddedErrata job#1537
swadeley wants to merge 4 commits into
content-services:mainfrom
swadeley:swadeley/HMS-9952

Conversation

@swadeley

Copy link
Copy Markdown
Member

Summary

HMS-9952 add job to send update events for all templates with added advisories

Testing steps

snapshot a repo
make a template
make kafka-topic-consume KAFKA_TOPIC=platform.content-sources.template # in term 1
go run cmd/jobs/main.go newly-added-errata # in term 2

@swadeley swadeley requested a review from a team as a code owner June 11, 2026 14:51
@xbhouse

xbhouse commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@rverdile rverdile left a comment

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.

Bryttanie's PR (https://github.com/content-services/content-sources-backend/pull/1536/changes) adds calculating advisory changes. I wonder if this would just need to enqueue update-template-content jobs to trigger events for updates. What do you think?

@swadeley

Copy link
Copy Markdown
Member Author

Bryttanie's PR (https://github.com/content-services/content-sources-backend/pull/1536/changes) adds calculating advisory changes. I wonder if this would just need to enqueue update-template-content jobs to trigger events for updates. What do you think?

Hi, yes.
I could refactor now to add InternalOnlyListSnapshotErrataIDs or rebase to use it after it is merged.

EDIT: I will pull in InternalOnlyListSnapshotErrataIDs now rather than wait for that PR to be merged.

@rverdile

Copy link
Copy Markdown
Contributor

@swadeley I'm a little confused about what the ticket is asking for. Is this understanding correct?

This job meant to run before the changes in Bryttanie's PR start sending template update events, meaning it populates the initial errata for the template, and then Bryttanie's PR starts calculating the diff.

@swadeley swadeley force-pushed the swadeley/HMS-9952 branch 2 times, most recently from 2919400 to f7a1e70 Compare June 15, 2026 08:42
@swadeley

Copy link
Copy Markdown
Member Author

@swadeley I'm a little confused about what the ticket is asking for. Is this understanding correct?

This job meant to run before the changes in Bryttanie's PR start sending template update events, meaning it populates the initial errata for the template, and then Bryttanie's PR starts calculating the diff.

Hi @rverdile , yes, Justin confirmed, my job is a standalone backfill job that will be run when Patch is ready to accept and make use of the updates Bryttanie's PR code is sending.

@swadeley swadeley force-pushed the swadeley/HMS-9952 branch from f7a1e70 to 6bdf800 Compare June 15, 2026 14:13
@xbhouse

xbhouse commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@swadeley I'm a little confused about what the ticket is asking for. Is this understanding correct?

This job meant to run before the changes in Bryttanie's PR start sending template update events, meaning it populates the initial errata for the template, and then Bryttanie's PR starts calculating the diff.

sorry for the confusion @rverdile! as @swadeley said, Justin confirmed this job is meant to be run after my PR is merged and after patch can store these relationships, so the ticket to run this job should be done last. i've updated the dependencies for each ticket so the order is clearer

Comment thread pkg/jobs/newly_added_errata.go Outdated
@rverdile

Copy link
Copy Markdown
Contributor

Thanks guys, I'm still a little confused where this sits in context with everything else. What is the reason for the backfill here? Are the updates added in @xbhouse's PR already being sent before this job runs? I noticed that PR has a feature flag - does that stay off until this job runs?

@swadeley

Copy link
Copy Markdown
Member Author

Thanks guys, I'm still a little confused where this sits in context with everything else. What is the reason for the backfill here? Are the updates added in @xbhouse's PR already being sent before this job runs? I noticed that PR has a feature flag - does that stay off until this job runs?

Hi @rverdile , code in PR# 1536 can be merged and send updates and but nothing will be done with them until feature is turned on.

Feature will not be turned on until:

  1. Patch is updated to accept and hold the data coming from content-sources
  2. My backfill job is run

@swadeley swadeley force-pushed the swadeley/HMS-9952 branch from 6bdf800 to 8c34bb0 Compare June 15, 2026 17:53
@xbhouse

xbhouse commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Thanks guys, I'm still a little confused where this sits in context with everything else. What is the reason for the backfill here? Are the updates added in @xbhouse's PR already being sent before this job runs? I noticed that PR has a feature flag - does that stay off until this job runs?

the reason for this job is to let patch know about the advisories for all existing templates. the diff updates from my PR will already be sending whenever a template is updated, but that wouldn't include the full set.

regarding the flag: patch should just drop message fields if it doesn't understand them, Michael suggested adding a feature flag though just in case. so we'd turn the flag on first, then run this job.

Find(&templates).Error
if err != nil {
log.Fatal().Err(err).Msg("failed to fetch templates")
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Would it be better to do:

if err != nil {
    log.Error().Err(err).Msg("failed to fetch templates")
    return
}

Comment thread pkg/jobs/newly_added_errata.go Outdated

var templates []models.Template
err = db.DB.
Preload("TemplateRepositoryConfigurations.Snapshot").

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think paginate through the templates here?

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