refactor(plugin): clean up --yes wiring in plugin cmds - #809
Closed
ajalon1 wants to merge 7 commits into
Closed
Conversation
fix(ci): pin arduino/setup-task Task version to 3.52.0 `version: 3.x` in the three arduino/setup-task call sites floats to whatever go-task/task release GitHub reports as latest on every run. go-task/task cut v3.53.1 on 2026-08-18 but its release assets weren't fully published until ~18 minutes after the tag was created; our build-windows and smoke-test (macos-latest) jobs ran in that window, resolved the brand-new tag, and 404'd downloading its binary: Failed to download version v3.53.1: Unexpected HTTP response: 404 Pin to the exact, already-published 3.52.0 to close the race, matching the project's existing convention of pinning tool versions explicitly (GOLANGCI_LINT_VERSION, LEFTHOOK_VERSION, JSCPD_VERSION, GORELEASER_VERSION in Taskfile.yaml). The action.yaml pin mirrors the fix Taras Pokornyy already landed for that call site in #788; this extends it to the two other call sites his PR doesn't touch. Co-authored-by: Taras Pokornyy <34406052+taras-pokornyy@users.noreply.github.com>
* Update Docker base image to latest version unpin wolfi images since they disappear * Update Dockerfile.goreleaser
Adds a `RootFactory` type (`cmd/root_factory.go`) that constructs the root cobra command from a set of injectable `Dependencies`, mirroring the approach used by GitHub CLI (`pkg/cmdutil.Factory`) and kubectl (`pkg/cmd/util.Factory`). Key changes: - `cmd/root_factory.go`: defines `RootFactory`, `Dependencies`, and five functional option helpers (`WithConfigInitializer`, `WithTLSSetup`, `WithTelemetryProps`, `WithTelemetryClient`, `WithAnimation`, `WithPluginRegistrar`). Each `Build()` call returns a fresh, fully-wired `*cli.CommandAdder` with no shared mutable state. - `cmd/root_helpers.go`: extracts `showFirstRunAnimation` and `setUnknownArgGuards` from the old `root.go` into a focused helper file so the factory can call them without causing import cycles. - `cmd/root.go`: reduced to a thin bootstrap that registers import-cycle- breaking function values (`allCommandsOutputFn`, `runVersionCommandFn`), builds the production singleton via `NewRootFactory()`, and exposes the familiar `RootCmd` package-level var for backward compatibility. - `cmd/exit.go`: updated to read the telemetry client from `productionFactory.TelemetryClient()` rather than a package-level pointer, so `Exit()` always flushes the most recently set client. - `internal/telemetry/interaction.go` + `interaction_test.go`: ports the `StampInteractionMode` / `computeNonInteractive` / `hasYesFlag` helpers from PR #797 so the factory's `persistentPreRun` can stamp `NonInteractive` on every event without per-command duplication. - `internal/telemetry/properties.go` + `properties_test.go`: adds the `NonInteractive bool` field to `CommonProperties` and `non_interactive` to `AsMap()`; updates tests to assert the field is always present. Validation: `go build ./cmd/...`, `go test -race ./cmd/... ./internal/telemetry/...` all green; `task lint` reports 0 issues across linux, darwin, and windows. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…ndling Ports PR #797 (aj/track-non-interactive) onto the factory branch, integrating with the RootFactory plumbing already in place. What this commit adds on top of #799: internal/cli/flags.go — YesFlagName constant ("yes") as the single canonical source for --yes flag registration across all commands. internal/cli/runtime.go + runtime_test.go — IsNonInteractive(cmd) centralizes the three-source check (force-interactive viper key, DATAROBOT_CLI_NON_INTERACTIVE env var, --yes flag) so individual commands no longer inline the two-line OR pattern themselves. internal/telemetry/interaction.go — simplified: StampInteractionMode now delegates entirely to cli.IsNonInteractive, removing the local yesFlagName / computeNonInteractive / hasYesFlag helpers that #799 had added. internal/telemetry/properties.go — seeds NonInteractive from reader.IsNonInteractive() in CollectCommonProperties so automation workflows are marked even when the dispatched command has no --yes flag. Command migrations (all replace the two-line yesFlag || viperx.GetBool pattern with cli.IsNonInteractive): cmd/artifact/code/checkout, codesync, init cmd/artifact/del cmd/dependencies/install (+test) cmd/dotenv cmd/plugin/install cmd/start cmd/workload/config, del, up Docs: telemetry.md, flags.md, AGENTS.md updated to describe IsNonInteractive and YesFlagName as the canonical patterns. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Replace the package-level yesFlag variable with proper cmd threading. confirmPluginDepsInstall now receives the real *cobra.Command and calls cli.IsNonInteractive(cmd) directly, which checks --yes via cmd.Flags(), the NON_INTERACTIVE env var, and viperx in priority order. Previously, passing nil to IsNonInteractive fell back to the weaker viperx-only path and the package-level yesFlag was shared state that could leak across successive Execute calls in the same process. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Contributor
Author
|
Closing in favor of #810. still getting the hang of github PR stacks |
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.
RATIONALE
CHANGES
PR Automation
Comment-Commands: Trigger CI by commenting on the PR:
/trigger-smoke-testor/trigger-test-smoke- Run smoke tests/trigger-install-testor/trigger-test-install- Run installation testsLabels: Apply labels to trigger workflows:
run-smoke-testsorgo- Run smoke tests on demand (only works for non-forked PRs)Important
For Forked PRs: The
run-smoke-testslabel won't work. A required Smoke Tests check will block merge until a maintainer acts:/approve-smoke-teststo run smoke tests (results will set the check)/skip-smoke-teststo bypass the check without running testsPlease comment requesting a maintainer review if you need smoke tests to run.