Skip to content

fix(backend): populate task runtime state in TaskStore scanRows. Fixes #13975 - #13976

Open
jahnavigajjala-3 wants to merge 1 commit into
kubeflow:masterfrom
jahnavigajjala-3:fix/taskstore-scanrows-state
Open

fix(backend): populate task runtime state in TaskStore scanRows. Fixes #13975#13976
jahnavigajjala-3 wants to merge 1 commit into
kubeflow:masterfrom
jahnavigajjala-3:fix/taskstore-scanrows-state

Conversation

@jahnavigajjala-3

Copy link
Copy Markdown

Fixes #13975

Description

This PR fixes TaskStore.scanRows() to correctly populate the Task.State field when reading task records from the database.

Previously, the State column was selected from the database but was not scanned into the Task model. As a result, tasks returned by ListTasks, GetTask, and patchWithExistingTasks always had an empty runtime state, even when a persisted state existed in the database.

Changes

  • Scan the State column in TaskStore.scanRows().
  • Populate Task.State from the scanned database value.
  • Update storage tests to reflect the expected persisted runtime state.

Testing

go test ./backend/src/apiserver/storage/...

Checklist

  • You have signed off your commits.
  • The title for your pull request (PR) follows the repository title convention.

@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mprahl for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow

Copy link
Copy Markdown

Hi @jahnavigajjala-3. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dobbydobap

Copy link
Copy Markdown
Contributor

The State assignment is right, and it's a real gap. state was already scanned into a local at task_store.go:156 and passed to rows.Scan at :171, it just never reached the struct. Mirroring RunStore.scanRowsToRuns at run_store.go:412 is the right call.

Two formatting things. The indentation in scanRows went from tabs to spaces (:190-206), and the closing } on :207 now sits at column 0. .golangci.yml enables gofmt and goimports, and pre-commit runs golangci-lint with --new-from-merge-base, so it lints exactly these lines. gofmt -w clears it.

There's also a leftover on :202:

State:             model.RuntimeState(state.String), // <-- Add this line

On coverage: every added expectation is RuntimeStateUnspecified. That does tell fixed from unfixed, since the old code left State as the empty string. But #13975 is about a persisted state not coming back, and no test round-trips a task stored as SUCCEEDED or RUNNING. One fixture with a real state would cover the case users actually hit.

Signed-off-by: jahnavigajjala3-commits <jahnavigajjala3@gmail.com>
@jahnavigajjala-3
jahnavigajjala-3 force-pushed the fix/taskstore-scanrows-state branch from 73375b1 to 4caceed Compare August 6, 2026 10:52
@google-oss-prow google-oss-prow Bot added size/S and removed size/L labels Aug 6, 2026
@jahnavigajjala-3

Copy link
Copy Markdown
Author

@dobbydobap, Thanks for the detailed review! I've made changes accordingly,I'd appreciate another look when you have a chance

@dobbydobap

Copy link
Copy Markdown
Contributor

Checked at 4caceedd5, all three are addressed. Indentation is back to tabs, the closing brace is where it should be, the // <-- Add this line marker is gone, and the tests now use RuntimeStateRunning rather than only RuntimeStateUnspecified, so they cover the persisted-state case #13975 is actually about.

Production diff is a clean +1/-0 now. Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] TaskStore scanRows() does not restore persisted task State from the database

2 participants