feat(stacks): migrate app_pipeline.go from survey to huh#135
Open
feat(stacks): migrate app_pipeline.go from survey to huh#135
Conversation
Replace all survey-based prompts in AppStack with huh form builders. Extract pure form builder functions for each prompt (repository URL, branch, domains, healthcheck path, S3 buckets, SQS, database, Redis, SES, users, data-loss confirm) and update AskForDatabase, AskForRedis, AskForSES, WarnIfDataLoss, and AskQuestions to call them. Remove databaseSelectTransform and redisSelectTransform — replaced by typed huh.NewOption[string] values that carry the full stack name directly. Update cmd/modify.go askModifyQuestions to use the new huh form builders (AppRepositoryURLForm, AppBranchForm, AppDomainsForm, AppHealthCheckPathForm) instead of the removed survey-based helpers. Add table-driven uitest tests for every new form builder. Closes #123
blsmth
commented
Apr 16, 2026
Contributor
Author
blsmth
left a comment
There was a problem hiding this comment.
Code Review
Nice — this closes out the survey→huh migration cleanly. Flow is preserved, conditionals still fire in the right order, and the typed huh.Option[string] replacement for databaseSelectTransform/redisSelectTransform is much easier to reason about than the reflection-based callbacks.
Bug fix (already noted in PR body — good)
AskForRedisStack had a pre-existing bug where it compared against databaseStackNameTmpl instead of redisStackNameTmpl — so the pre-selection never matched. Correctly fixed here.
Test coverage gaps (worth follow-up, not blocking)
TestAppDataLossConfirmForm_Confirm/_Rejectdon't actually assert anything (_ = confirmedPtr). Given that "default = No = abort destructive op" is the whole point of preserving this flow, at least one test should verify*confirmedPtr == falseon default.TestAppPrivateS3Form_SelectYesusesSelectNth(tm, 0)which equalsSelectFirst, so withdefaultEnabled=falseit actually lands on "no". Misleading name, no assertion — drop or fix.- Missing coverage for "pre-existing selection" on
AppDatabaseStackForm/AppRedisStackForm— verify.Selected(true)on a non-first option is honored.
Nits
AskForDatabase—verbosegets the same value in both branches; pull it above theif.AppDatabaseStackForm/AppRedisStackFormpre-seedselected := options[0].Valuerather than thedefaultClasspattern used by the instance class forms. Works either way, but inconsistent.strings.Split(*domainsPtr, "\n")produces[""]for empty input — matches old survey behavior, not a regression, but easy cleanup as follow-up.
Safe to merge. Test gaps can land as a follow-up PR.
…on bug - TestAppDataLossConfirmForm: assert confirmed=true/false (was `_ = confirmedPtr`) - TestAppPrivateS3Form_SelectYes: navigate to "yes" and assert (was no-op) - Fix AppDatabaseStackForm/AppRedisStackForm: don't pre-seed selected value to options[0] — this overrode the caller's .Selected(true) marker, silently resetting existing selections in the `modify app` workflow - Add PreservesSelection tests for both stack forms
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.
Migrates the last remaining survey-using file to huh. Completes the migration chain started with #116.
Changes
stacks/app_pipeline.go— all 10+ survey prompts converted to huh forms (helper builders, AskForDatabase/Redis/SES, AskQuestions, WarnIfDataLoss)databaseSelectTransformandredisSelectTransform— replaced by huh typed optionscmd/modify.go— updated to use the renamed form buildersstacks/app_pipeline_test.go— teatest coverage for the new form buildersSilent bug fix
AskForRedisStackpreviously compared againstdatabaseStackNameTmplinstead ofredisStackNameTmplwhen pre-selecting the current redis stack — so the pre-selection never matched. Fixed in this migration.Closes #123