fix(data list): route through the listDatasetsFn seam + cover the query path#248
Merged
Conversation
…ry path - runDataList called push.ListDatasets directly, bypassing the listDatasetsFn seam its sibling dataset-query callers (destTableExists, resolveDeleteTarget) already use (data.go:1462). A real consistency bug that also left the path untestable. Now routes through the seam. - Split listDatasetsWith(ctx, exec Executor, …) out of ListDatasets so the exec + error-wrap + parse path is fakeable — it was 0% because ListDatasets built a real SPDYExecutor internally. Public signature and the listDatasetsFn seam are unchanged. - TestListDatasetsWith: happy parse, empty database, and a failing exec surfacing "querying datasets" + the remote stderr. fakeExecutor gains a stdoutToReturn field (no impact on the tar-stream callers). make ci green. Follow-up: the loadClusterFn routing + teardown/stage seams + their command-path tests (interlock with the resolveClusterTarget fixture). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 398b293. Configure here.
saadqbal
approved these changes
Jul 14, 2026
saadqbal
left a comment
Collaborator
There was a problem hiding this comment.
Nice — good catch that data list was the only dataset-query caller skipping the listDatasetsFn seam; routing it through matches destTableExists/delete and unblocks the tests. Refactor is behavior-preserving. LGTM 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second increment from the CLI test-coverage audit — the
data listpath. A focused slice of the "test seams" work: fixes a genuine consistency bug in production and makesListDatasets's query path testable, with the tests.Production changes
runDataListnow routes through thelistDatasetsFnseam (data_list.go:118). It was callingpush.ListDatasetsdirectly, while thelistDatasetsFnseam it should use already exists and is used two lines over bydestTableExists/resolveDeleteTarget(data.go:1462). This was a real consistency bug —data listwas the only dataset-query caller bypassing the seam — and it leftrunDataList's success/error paths untestable.ListDatasetssplit so its exec path is fakeable. The function built a realSPDYExecutorinternally, so the exec + error-wrap + parse logic sat at 0% (a real cluster was the only way in). ExtractedlistDatasetsWith(ctx, exec Executor, ns, pod, container)—ListDatasetsstill locates the mysql pod and builds the production executor, then delegates. Public signature and thelistDatasetsFnseam are unchanged.Test changes
TestListDatasetsWith(new) — drives the split-out core with a fakeExecutor: a query result is parsed into table names, an empty database yields no datasets, and a failing exec surfacesquerying datasets+ the remote stderr (viastderrSuffix).fakeExecutorgains astdoutToReturnfield (stream_test.go) — it previously discarded the stdout writer (it was built for tar-streaming, which doesn't read stdout). Now it can return a stdout body, whichListDatasetsneeds. Existing callers don't set it → no behavior change (all push tests still pass).Not in this PR (follow-ups)
The heavier seam work stays separate so each PR is reviewable:
runClusterInfo/runClusterDoctor/realProbeEnvthroughloadClusterFn/newClientsetFn, and theteardownFn/stageFnseams — plus the command-path tests they unblock (runDataDeleteexecute + partial-fail,runClusterInfopost-discovery,runDataListsuccess path). Those interlock with theresolveClusterTarget-success / Bound-PVC fixture the audit flagged, which I'll build next.Test plan
make cigreen (build,-race, gofmt, lint, schema).internal/pushpackage re-run to confirm thefakeExecutorchange didn't regress the tar-stream / stage / teardown tests.🤖 Generated with Claude Code
Note
Low Risk
Refactor and test seams only; production behavior for listing datasets is unchanged aside from consistent use of the existing injectable hook.
Overview
tracebloc data listnow callslistDatasetsFninstead ofpush.ListDatasetsdirectly, matchingdestTableExists/resolveDeleteTargetand enabling CLI tests to stub dataset listing.In
internal/push,ListDatasetsstill discovers the mysql pod and buildsSPDYExecutor, but the information_schema query, error wrapping, and parsing live in injectablelistDatasetsWith.TestListDatasetsWithcovers success, empty output, and exec failure (including stderr).fakeExecutorcan return stdout for those tests without changing tar-stream behavior whenstdoutToReturnis unset.Reviewed by Cursor Bugbot for commit 398b293. Bugbot is set up for automated code reviews on this repo. Configure here.