Skip to content

test(wizard): pin the AI provider so CreateSurveyWizardTest is deterministic - #109

Closed
ganjasan wants to merge 1 commit into
masterfrom
fix/create-wizard-tests-env
Closed

ganjasan wants to merge 1 commit into
masterfrom
fix/create-wizard-tests-env

Conversation

@ganjasan

Copy link
Copy Markdown
Owner

Why

test_flag_on_renders_wizard_chrome and test_flag_off_serves_legacy_page fail on a clean checkout of master and pass only on machines whose .env carries AI provider credentials. The create page renders two different button sets depending on ai_available (ai_client.provider_configured()): with a provider configured the empty-path button carries the strings the tests assert ("Start with an empty survey" / "Create empty"); without one the {% else %} branch renders a single "Create Survey" button. The tests never pinned the provider, so their outcome tracked the developer's environment instead of the code.

The wizard itself works correctly in both MOBILE_EDITOR_NAV states — this is a test-determinism fix only, no product change.

What

  • Class-level @override_settings(AI_PROVIDER='anthropic', ANTHROPIC_API_KEY='sk-test') on CreateSurveyWizardTest — the same pattern test_panel_is_present_when_provider_configured already uses.
  • Registers offset 210 (Mapsurvey-wizard-tests) in the .env.ports.example registry.
  • OpenSpec change fix-create-wizard-tests-env (backlog fix(analytics): make the biggest error group say what actually broke #148).

Testing

./run_tests.sh survey.tests.CreateSurveyWizardTest — 5/5 OK on a checkout with no AI keys in .env (previously 2 failures).

🤖 Generated with Claude Code

https://claude.ai/code/session_014jqjexPxbdqwsXXfkM3yah

…inistic

The create page renders different buttons depending on ai_available, so the
class asserted strings that only exist with a provider configured — passing
on machines whose .env holds AI keys and failing on a clean checkout. Pin
the provider at class level, same pattern as
test_panel_is_present_when_provider_configured. Also registers offset 210
for this worktree in .env.ports.example.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014jqjexPxbdqwsXXfkM3yah
@ganjasan
ganjasan deployed to fix/create-wizard-tests-env - mapsurvey-db PR #109 August 24, 2026 02:51 — with Render Active
@ganjasan
ganjasan deployed to fix/create-wizard-tests-env - mapsurvey-celery PR #109 August 24, 2026 02:52 — with Render Active
@ganjasan
ganjasan temporarily deployed to fix/create-wizard-tests-env - mapsurvey PR #109 August 24, 2026 02:52 — with Render Destroyed
@ganjasan
ganjasan temporarily deployed to fix/create-wizard-tests-env - mapsurvey-celery PR #109 August 31, 2026 08:43 — with Render Destroyed
@ganjasan ganjasan closed this Sep 7, 2026
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.

1 participant