Skip to content

Add compare, clone, rollback, and remote-reference commands from SDK v0.2.10 - #246

Merged
chrisghill merged 4 commits into
mainfrom
sdk-update-202607
Jul 21, 2026
Merged

Add compare, clone, rollback, and remote-reference commands from SDK v0.2.10#246
chrisghill merged 4 commits into
mainfrom
sdk-update-202607

Conversation

@chrisghill

Copy link
Copy Markdown
Member

Summary

Surfaces new functionality from massdriver-sdk-go PR #34 (v0.2.10) in the CLI. Each command is a thin wrapper over a newly-added public SDK method, following the existing command patterns (cobra builders, -o text|json where it applies, embedded helpdocs, generated reference docs).

New commands

Command SDK method Description
mass deployment compare <src> <tgt> Deployments.Compare Bundle-version + leaf-level param diff between two deployments
mass environment compare <src> <tgt> Environments.Compare Instance-by-instance diff of two environments
mass instance rollback <deployment-id> Deployments.Rollback Propose returning an instance to a past COMPLETED deployment (goes through the normal approve/reject flow)
mass instance remote-reference set <instance> <field> <resource-id> Instances.SetRemoteReference Override a connection slot with a resource from another project
mass instance remote-reference remove <instance> <field> Instances.RemoveRemoteReference Remove the override, reverting to blueprint wiring
mass project clone <src> <new-id> Projects.Clone Clone a project's blueprint into a new project (mirrors env fork)

Enhancements

  • mass project list gains --name (exact match) and --search (free-text) filters, backed by the new projects.ListInput fields.

Both compare commands

  • Print a version diff plus a table of leaf-level param changes; only differences are shown by default, --all includes unchanged entries.
  • Support -o json for the full structured comparison.
  • Share rendering helpers in cmd/compare.go.

Refactor

  • Extracted streamDeploymentLogs from deployment logs so log-tailing (with the no-PAT static-log fallback) can be reused.

Notes / out of scope

  • mass instance plan was intentionally not added. Deployments.Plan overlaps with the existing instance deploy --plan; its only distinct use case (previewing a proposal pre-approval) isn't requested yet and would be better placed as mass deployment plan if it ever is.
  • Grants not included. The SDK PR also adds resource grant listing and a full OCI-repo grants feature; the CLI exposes no grant commands today, so that's deferred to its own PR (larger new subcommand tree).

@chrisghill
chrisghill requested a review from coryodaniel as a code owner July 21, 2026 22:20
@chrisghill

Copy link
Copy Markdown
Member Author

@claude review

@claude

claude Bot commented Jul 21, 2026

Copy link
Copy Markdown

Claude finished @chrisghill's task in 3m 16s —— View job


Review

Solid PR — the new commands (compare, rollback, remote-reference, clone) follow the existing thin-wrapper pattern closely, docs/helpdocs are generated consistently, and CI (build, lint, tests) is green. One real bug found, plus a couple of minor notes.

🐛 Bug: mass instance rollback help text references a command that doesn't exist

docs/helpdocs/instance/rollback.md:5 (and the generated docs/generated/mass_instance_rollback.md:17):

The returned proposal goes through the normal review flow: approve it with mass deployment approve, discard it with mass deployment reject, or preview it with mass instance plan.

Per this PR's own description, mass instance plan was intentionally not addedDeployments.Plan overlaps with instance deploy --plan, and there's currently no way to preview an already-created PROPOSED deployment before approval. So the help text points users at a subcommand that doesn't exist in the CLI (cmd/instance.go has no plan command; the only plan is the --plan flag on instance deploy, which operates on an instance name, not a deployment id, and doesn't apply to previewing an existing proposal).

Suggest either dropping that clause or rephrasing, e.g. "approve it with mass deployment approve or discard it with mass deployment reject" (no preview option today).

Fix this →

Minor notes

  • go.mod:18 pins massdriver-sdk-go to a pseudo-version (v0.2.10-0.20260721201746-c925c95365f7) rather than a tagged v0.2.10 release, even though the PR title/description say "v0.2.10". Worth confirming this is intentional (e.g. the tag hadn't been cut yet when this was bumped) and re-pinning to the real tag once it exists, so go.sum doesn't carry a commit-pinned dependency long-term.
  • docs/helpdocs/project/list.md (prose help, not shown in the diff) wasn't updated to mention the new --name/--search flags — only the cobra-generated options table picked them up automatically. Not required, but a short mention in the synopsis would help discoverability.
  • In printEnvironmentComparison (cmd/environment.go:755), when an instance exists on only one side (ic.Source == nil or ic.Target == nil), it still unconditionally prints the "bundle version" line and param table for that instance, which will show as all /one-sided entries. Not wrong, just double-check this reads well in practice — may be worth an early continue after the "(only in target/source)" line if the param table adds noise in that case.
  • Nice touches: the //nolint:dupl comments on the near-identical runDeploymentCompare/runEnvironmentCompare and renderDeployment/renderInstance pairs correctly explain why the duplication is being kept rather than just suppressing the linter silently.

Not reviewed

I wasn't able to run go build/go vet locally in this sandbox (network/tool restrictions), but CI's Test and golangci-lint jobs both passed, which covers compilation and static analysis.
· branch sdk-update-202607

@chrisghill
chrisghill merged commit 804a254 into main Jul 21, 2026
5 checks passed
@chrisghill
chrisghill deleted the sdk-update-202607 branch July 21, 2026 23:02
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.

2 participants