Skip to content

[BACK-4528] Retire the summary task runners and the outdated-flag mechanism - #969

Open
toddkazakov wants to merge 4 commits into
upload-postprocess-workfrom
upload-postprocess-cleanup
Open

[BACK-4528] Retire the summary task runners and the outdated-flag mechanism#969
toddkazakov wants to merge 4 commits into
upload-postprocess-workfrom
upload-postprocess-cleanup

Conversation

@toddkazakov

Copy link
Copy Markdown
Contributor

Single cleanup PR collapsing the previously planned PR2 + PR3 + the legacy field removal, stacked on #968.

Task service: deletes summary/task (update + migration runners), deregisters them, and replaces the EnsureSummary*Task defaults with DeleteDeprecatedTasks, which removes the org.tidepool.summary.* task rows on startup (kept at least one release).

Data service: removes the GET /v1/summaries/{outdated,migratable}/* routes and handlers. POST /v1/summaries/{type}/{userId} remains as a manual recalc lever: it now enqueues upload postprocess work (DATA_ADDED) and returns 202 instead of recalculating synchronously. Shrinks Summarizer (drops SetOutdated/GetOutdatedUserIDs/GetMigratableUserIDs), removes the corresponding store methods, the tidepool_summary_queue_lag/queue_length metrics, the data-client methods and panic stubs, and the two outdated index models (physical index drops stay in the ops runbook).

Legacy fields: removes Dates.OutdatedSince/OutdatedReason/LastUpdatedReason, the OutdatedReason* constants, SetOutdated/SetNotOutdated, and types.OutdatedSummariesResponse. Grep clearance: blip references the fields only in a Storybook fixture; jellyfish only as local variable names; clinic service carries them in its own API where they simply go empty. A schema-version mismatch now recreates the summary from nothing (previously SetOutdated(SCHEMA_MIGRATION) + reset), and the no-new-data path no longer writes (there is no flag left to clear).

Deploy gates: PR #968 and jellyfish deployed everywhere; tidepool_summary_queue_length at zero and staying there; deploy together with tidepool-org/clinic-worker#123, which removes the CDC EHR-sync trigger that read lastUpdatedReason.

Tests: 82 packages green across summary/..., data/..., task/..., work/...; the failing-cursor regression test is ported from GetOutdatedUserIDs to ListMigratableUserIDs.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (4)
  • master
  • main
  • develop
  • release.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c1c29a68-98ab-4d06-9bfc-c14d445e9d14

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@toddkazakov
toddkazakov force-pushed the upload-postprocess-cleanup branch from be999df to 78492bd Compare August 26, 2026 09:20
@toddkazakov
toddkazakov force-pushed the upload-postprocess-work branch from 6f9ac80 to f986282 Compare August 26, 2026 13:44
@toddkazakov
toddkazakov force-pushed the upload-postprocess-cleanup branch from 78492bd to 5cd5257 Compare August 26, 2026 13:47
@toddkazakov
toddkazakov force-pushed the upload-postprocess-work branch from f986282 to 0a9631d Compare August 26, 2026 16:38
@toddkazakov
toddkazakov force-pushed the upload-postprocess-cleanup branch 4 times, most recently from 21e3867 to 1521883 Compare August 27, 2026 16:02
@toddkazakov
toddkazakov force-pushed the upload-postprocess-work branch from 915c6cf to 163e277 Compare August 27, 2026 16:02
@toddkazakov
toddkazakov force-pushed the upload-postprocess-cleanup branch from 1521883 to 0e86095 Compare August 27, 2026 16:54
@toddkazakov

Copy link
Copy Markdown
Contributor Author

/deploy dev

@tidebot

tidebot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

toddkazakov updated values.yaml file in dev1

@tidebot

tidebot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

toddkazakov updated flux policies file in dev1

@tidebot

tidebot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

toddkazakov deployed platform upload-postprocess-cleanup branch to dev1 namespace

@toddkazakov
toddkazakov force-pushed the upload-postprocess-cleanup branch from 0e86095 to a60a9f1 Compare August 31, 2026 10:01
@toddkazakov
toddkazakov force-pushed the upload-postprocess-work branch from db993f4 to 5b20992 Compare September 1, 2026 17:25
@toddkazakov
toddkazakov force-pushed the upload-postprocess-cleanup branch from a60a9f1 to 22452e0 Compare September 1, 2026 17:31
@toddkazakov toddkazakov changed the title Retire the summary task runners and the outdated-flag mechanism [BACK-4528] Retire the summary task runners and the outdated-flag mechanism Sep 2, 2026

@ewollesen ewollesen 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.

Claude also pointed out that some metrics mentioned in the README are no longer collected. It would be good to update that.

Nothing major, but things that I feel like should be addressed.

Nice work!

Comment thread summary/summary.go
userSummary.SetOutdated(types.OutdatedReasonSchemaMigration)
userSummary.Dates.Reset()
// A summary calculated with an outdated schema is recreated from nothing
*userSummary = *types.Create[PP, PB](userId)

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.

Claude points out that the existing summary's _id is lost. Create doesn't set one. Later on, the summary is upserted via userId/type, which means that the existing database record will be updated and still have the correct _id, however the summary in Go won't have the correct _id, it'll have 0.

I didn't follow the whole chain of calls to see if/how userSummary's _id is used from there, but it goes through quite a few other methods, so having an invalid _id seems like a time bomb waiting to explode.

Does it make sense to make sure that the existing userSummary's _id is still there? That's how the old code would have worked I believe, since it didn't recreate from scratch.

This might not have been caught, because the tests that covered this branch were removed.


func UpdateSummary[PP types.PeriodsPt[P, PB, B], PB types.BucketDataPt[B], P types.Periods, B types.BucketData](dataServiceContext dataService.Context) {
// UpdateSummary reports the data of the user as changed rather than recalculating synchronously,
// which the retired task runners required. The work created recalculates every summary of the user.

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.

Is there a migration plan to collapsed the three endpoints down to one, since all three do the same work?

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