feat(dataset): port dry-run and impact from Go CLI#16
Draft
beengud wants to merge 1 commit into
Draft
Conversation
Adds `dataset dry-run` and `dataset impact` subcommands to the existing
dataset route, ported from the deprecated Go Observe CLI.
- dry-run: previews saving a dataset pipeline via `saveDataset` with
`dependencyHandling.saveMode = PreflightDatasetAndDependencies` (nothing
persisted); reports the dataset, rematerialized datasets, and compile
errors, exiting 1 if any error datasets are returned.
- impact: renders a table of downstream datasets affected by a save and
sends compile/validation errors to stderr.
The Go source queried a `saveDatasetDryRun` mutation and
`affectedDatasets { dataset { id name } dependencyType }` field that do not
exist in the published GraphQL schema; the operations here were rewritten
against the real SDL.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #5
Ported surface
Adds two subcommands to the existing
datasetroute (existinglist/viewuntouched):dataset dry-run <file.json>— Dry-runs saving a dataset pipeline; nothing is persisted. Prints the dataset that would be saved (Dataset: <name> (<id>)), datasets that would be rematerialized (Would rematerialize: <name> (<id>)), and compile/validation errors (Error in <name>: <text>). Exits1when any error datasets are returned.dataset impact <file.json>— Renders a table (NAME / ID / IMPACT) of downstream datasets affected by saving the pipeline. Compile/validation errors go to stderr. Supports--format json|csv/--json. Nothing is persisted.Input JSON shape (matches the Go CLI):
{ "workspaceId": "...", "dataset": { "name": "..." }, "query": { "stageQueries": [{ "stageID": "...", "pipeline": "..." }] } }Schema-vs-Go corrections (the Go source did not match the published SDL)
The Go fork queried fields that do not exist in the published schema; these were rewritten against the real SDL (
terraform-provider-observe):saveDatasetDryRunmutationsaveDataset(..., dependencyHandling: { saveMode: PreflightDatasetAndDependencies })— the schema's preflight/dry-run mechanism (matchesoperation/dataset.graphql)errorDatasets { dataset { id name } errorText }DatasetError { datasetId, datasetName, text }(no nested dataset, noerrorText)datasetName/textgetDatasetsAffectedByDatasetUpdate { affectedDatasets { dataset { id name } dependencyType } }DatasetsAffectedByDatasetUpdateResulthas onlydematerializedDatasets,editForwardDematerializedDatasets,rematerializationCosts— noaffectedDatasets/dependencyTypedematerializedDatasets+editForwardDematerializedDatasets(dataset { id name }); the IMPACT column reflects which list a row came from.dependencyTypeis not exposed by the schema and could not be reproduceddataset: { name }mapped directlyDatasetInput.label: String!(nonamefield)dataset.name→DatasetInput.labelquery.stageQueries[].stageIDMultiStageQueryInputrequiresoutputStage: String!+stages: [StageQueryInput!]!where the field isid(notstageID) andinput: [InputDefinitionInput!]!is requiredstageID→id, setinput: [], deriveoutputStagefrom the terminal stageThe impact command issues a second preflight
saveDatasetto obtainerrorDatasets, sincegetDatasetsAffectedByDatasetUpdatedoes not return them.Verification
src/gql/dataset/**):✔ Generate— both operations validate against the published SDL.tsconfig): no errors insrc/commands/datasetorsrc/gql/datasetsource files (pre-existing unrelated errors from missingrest/generated/other resources' types are out of scope).eslint+prettierclean on all new/edited files.bun test src/commands/dataset/{dry-run,impact,input}.test.ts→ 14 pass / 0 fail, 32 assertions across 3 files.🤖 Generated with Claude Code