Skip to content

feat(stacks): migrate app_pipeline.go from survey to huh#135

Open
blsmth wants to merge 2 commits intomainfrom
agent/go-engineer/issue-123
Open

feat(stacks): migrate app_pipeline.go from survey to huh#135
blsmth wants to merge 2 commits intomainfrom
agent/go-engineer/issue-123

Conversation

@blsmth
Copy link
Copy Markdown
Contributor

@blsmth blsmth commented Apr 16, 2026

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)
  • Deleted databaseSelectTransform and redisSelectTransform — replaced by huh typed options
  • cmd/modify.go — updated to use the renamed form builders
  • stacks/app_pipeline_test.go — teatest coverage for the new form builders

Silent bug fix

AskForRedisStack previously compared against databaseStackNameTmpl instead of redisStackNameTmpl when pre-selecting the current redis stack — so the pre-selection never matched. Fixed in this migration.

Closes #123

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
Copy link
Copy Markdown
Contributor Author

@blsmth blsmth left a comment

Choose a reason for hiding this comment

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

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 / _Reject don'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 == false on default.
  • TestAppPrivateS3Form_SelectYes uses SelectNth(tm, 0) which equals SelectFirst, so with defaultEnabled=false it 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

  • AskForDatabaseverbose gets the same value in both branches; pull it above the if.
  • AppDatabaseStackForm/AppRedisStackForm pre-seed selected := options[0].Value rather than the defaultClass pattern 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
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.

Migrate stacks/app_pipeline.go from survey to huh

1 participant