Skip to content

[CFX-4857][CFX-4611] Added support for pulumi login during start and dotenv setup#344

Open
carsongee wants to merge 4 commits intodatarobot-oss:mainfrom
carsongee:carsongee/CFX-4857
Open

[CFX-4857][CFX-4611] Added support for pulumi login during start and dotenv setup#344
carsongee wants to merge 4 commits intodatarobot-oss:mainfrom
carsongee:carsongee/CFX-4857

Conversation

@carsongee
Copy link
Copy Markdown
Contributor

@carsongee carsongee commented Feb 3, 2026

RATIONALE

Pulumi onboarding is still a challenge for our users. This bakes that into the configuration and allows the user to set a universal securely generated passphrase for all DataRobot templates they might explore without prompting for this configuration.

CHANGES

pulumi-experience


Note

Medium Risk
Adds a new interactive Pulumi login + passphrase generation flow that runs external pulumi commands and writes a shared passphrase into the user config, which can affect onboarding behavior and error paths. Changes are localized to setup TUIs and prompt/value resolution, with added tests to reduce regression risk.

Overview
Adds Pulumi onboarding to template configuration flows. dr dotenv setup and template setup now detect when Pulumi is required (via PULUMI_CONFIG_PASSPHRASE prompts) and, if needed, run a new pre-wizard TUI screen that guides backend selection (pulumi login local/cloud/DIY) and can auto-generate and persist a default passphrase in ~/.config/datarobot/drconfig.yaml.

Improves prompt/value resolution and error handling. envbuilder now sources PULUMI_CONFIG_PASSPHRASE from viper config (with env var and .env taking precedence), dotenv prompt loading falls back to reading .env when variables aren’t preloaded, and dotenv setup now unwraps the final TUI model to surface Pulumi/login errors. Tests were added/updated to isolate host env/viper leakage and validate the Pulumi flow and precedence rules.

Written by Cursor Bugbot for commit b271cc8. This will update automatically on new commits. Configure here.

@carsongee carsongee changed the title [CFX-4857] Added support for pulumi login during start and dotenv setup [CFX-4857][CFX-4611] Added support for pulumi login during start and dotenv setup Mar 4, 2026
@carsongee carsongee force-pushed the carsongee/CFX-4857 branch 2 times, most recently from dd1fb86 to cd8718d Compare March 12, 2026 03:30
@carsongee carsongee marked this pull request as ready for review March 12, 2026 03:31
@github-actions
Copy link
Copy Markdown
Contributor

🔐 Smoke tests approved by maintainer

⏳ Running security scans before executing smoke tests with secrets...

A maintainer has approved this fork PR to run smoke tests. Security scans will run first.

@carsongee carsongee force-pushed the carsongee/CFX-4857 branch from cd8718d to 0422da9 Compare March 12, 2026 04:10
@github-actions
Copy link
Copy Markdown
Contributor

Some smoke tests failed. (Fork PR)

✅ Security Scan: success
❌ Linux: failure
✅ Windows: success

View run details

}

return nil
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded config path ignores XDG_CONFIG_HOME

Medium Severity

savePassphraseToConfig hardcodes the config directory as filepath.Join(homeDir, ".config", "datarobot"), but the project's config.GetConfigDir() respects XDG_CONFIG_HOME. When XDG_CONFIG_HOME is set to a non-default path, the os.MkdirAll creates the wrong directory, and viper.WriteConfig() may fail because the actual config directory (at the XDG path) might not exist.

Fix in Cursor Fix in Web

// If Pulumi login sub-model is active, delegate to it
if m.pulumiModel != nil {
return m.handlePulumiUpdate(msg)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WindowSizeMsg lost during Pulumi login flow

Low Severity

When pulumiModel is active, all messages including tea.WindowSizeMsg are delegated to handlePulumiUpdate, which doesn't update the parent Model's width and height. If the terminal is resized during the Pulumi login flow, the parent model retains stale dimensions, causing potential layout issues when the wizard screen renders afterward.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

@shreyaag-dr shreyaag-dr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for adding this.

Copy link
Copy Markdown

@dr-nate-daly-pm dr-nate-daly-pm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@ajalon1
Copy link
Copy Markdown
Contributor

ajalon1 commented Mar 20, 2026

@carsongee Is this one in need of review, or stale?

@ajalon1 ajalon1 self-assigned this Mar 20, 2026
@carsongee
Copy link
Copy Markdown
Contributor Author

@carsongee Is this one in need of review, or stale?

It is in need of review. I just moved it from Draft to Ready for Review last week, and I got Product sign off on Tuesday @ajalon1

@github-actions
Copy link
Copy Markdown
Contributor

🔐 Smoke tests approved by maintainer

⏳ Running security scans before executing smoke tests with secrets...

A maintainer has approved this fork PR to run smoke tests. Security scans will run first.

@github-actions
Copy link
Copy Markdown
Contributor

Some smoke tests failed. (Fork PR)

✅ Security Scan: success
❌ Linux: failure
✅ Windows: success

View run details

@carsongee carsongee force-pushed the carsongee/CFX-4857 branch from b9eae1b to 1b6ae7e Compare March 25, 2026 14:13
m.err = fmt.Errorf("failed to generate passphrase: %w", err)

return m, nil
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passphrase generation error mishandles program flow

Medium Severity

When generateRandomPassphrase fails, handlePassphraseAccepted sets m.err and returns nil cmd, but the savePassphraseToConfig error path properly sends a pulumiLoginErrorMsg which triggers tea.Quit. This inconsistency leaves the user on a screen displaying "Pulumi Login Failed" (misleading for a passphrase error) while the key handler still silently responds to passphrase-prompt keys (y/n/esc) that aren't shown in the error view. Pressing n silently discards the error and proceeds to the wizard as if nothing happened.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

}

if len(yamlFiles) == 0 {
return nil, nil
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing early return changes behavior for repos without YAML

Medium Severity

Removing the len(yamlFiles) == 0 early return means GatherUserPrompts now always returns core prompts (DATAROBOT_ENDPOINT, DATAROBOT_API_TOKEN) even for repos with no yaml files. This causes checkPromptsAvailable to always return true (showing the "w" wizard option), and the promptsLoadedMsg handler to skip the len(prompts) == 0 branch. The wizard then silently runs through hidden core prompts and writes the .env file without any user interaction.

Fix in Cursor Fix in Web

@github-actions
Copy link
Copy Markdown
Contributor

🔐 Smoke tests approved by maintainer

⏳ Running security scans before executing smoke tests with secrets...

A maintainer has approved this fork PR to run smoke tests. Security scans will run first.

@github-actions
Copy link
Copy Markdown
Contributor

Some smoke tests failed. (Fork PR)

✅ Security Scan: success
❌ Linux: failure
✅ Windows: success

View run details

@github-actions
Copy link
Copy Markdown
Contributor

Some smoke tests failed. (Fork PR)

✅ Security Scan: success
❌ Linux: cancelled
✅ Windows: success

View run details

@github-actions
Copy link
Copy Markdown
Contributor

Some smoke tests failed. (Fork PR)

✅ Security Scan: success
❌ Linux: failure
✅ Windows: success

View run details

@carsongee
Copy link
Copy Markdown
Contributor Author

Tests are failing because of the key rotation

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.

4 participants