Skip to content

fix(tests): green warp-app on linux/macOS/windows#164

Merged
BunsDev merged 1 commit into
mainfrom
fix/linux-tests-cross-platform
May 30, 2026
Merged

fix(tests): green warp-app on linux/macOS/windows#164
BunsDev merged 1 commit into
mainfrom
fix/linux-tests-cross-platform

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 30, 2026

Summary

Fixes 8 failing tests across the warp-app suite. Failures split into three categories:

1. Brand / rebrand drift

Assertions still pinned to upstream "Warp" copy after the CastCodes rebrand.

  • context_chips::display_chip::tests::test_format_git_branch_command_reports_missing_linked_worktree_path — error string now expects CastCodes instead of Warp.
  • settings_view::environments_page::tests::test_render_list_page_with_personal_and_team_environments_shows_section_headers — section header expects SHARED BY CASTCODES AND ....

2. Cross-platform path / OS gates

  • ai::blocklist::handoff::touched_repos::tests/repo and /repo/subdir are not absolute on Windows, so Path::is_absolute() rejected them and the touched-path collector dropped the cwd entry. Swap the literals for a cfg(windows)-aware REPO_ROOT / REPO_SUBDIR constant (C:\repo on Windows, /repo elsewhere).
  • launch_mode_tests::castcodes_app_bundle_executable_launches_gui — the bundle-detection branch this test exercises (is_macos_app_bundle_executable) is macOS-only; on Linux/Windows it returns false and should_run_as_cli falls through, breaking the assertion. Gated with #[cfg(target_os = "macos")].

3. Drift from production-code changes (OSS / fork-local guards + harness gating)

  • ai::blocklist::action_model::execute::start_agent::tests::execute_returns_error_when_local_harness_child_requires_orchestration_v2"codex" no longer parses as a valid local-harness child, so parsing failed before the test could reach the OrchestrationV2 gate. Switched to "claude" so parsing succeeds.
  • drive::import::modal_body::import_tests::test_expand_directories — three new theme fixtures (tweakcn_sample_dark.yaml, tweakcn_sample_light.yaml, ui_block_theme.yaml) were added to crates/integration/tests/data/. Updated the snapshot to include them.
  • pane_group::tests::test_start_shared_session_from_modalopen_share_session_modal now early-returns when cloud_services_available() is false, which is the case on the default OSS channel used in unit-test builds. Added a #[cfg(feature = "test-util")] RAII guard ChannelState::override_channel_for_test(Channel) in warp_core and used it to flip the test into a hosted channel for its duration. The production OSS fork-local gate is preserved.
  • auth::auth_manager::auth_manager_test::test_stale_state_when_logged_out_emits_invalid_state_parameter and test_mismatched_state_with_different_user_uid_emits_invalid_state_parameterinitialize_user_from_auth_payload was bailing on hosted_auth_disabled before running CSRF state validation, so the InvalidStateParameter event the tests assert on never fired in OSS builds. Reordered: CSRF state validation runs first (it consumes a locally-generated pending-state token and never touches the hosted backend, so it's safe to run regardless of channel), then the hosted-auth-disabled bail happens before any auth_client interaction.

Test plan

  • cargo nextest run -p warp-app --no-fail-fast — 4212 passed, 7 skipped, 1 pre-existing failure: settings::init::tests::test_migration_does_not_rerun_when_marker_present. This test reads ~/.cast-codes/settings.toml directly from the real home dir (not sandboxed) and fails on any machine that has actually used CastCodes. Reproduces on main unchanged — out of scope for this PR.
  • cargo fmt --check clean.
  • CI clippy will likely flag a pre-existing clippy::unnecessary_unwrap in crates/warpui_core/src/elements/hoverable.rs:661 (also on main, also out of scope).
  • CI Linux + Windows runs.

🤖 Generated with Claude Code

Eight failing tests in the warp-app suite split into three categories:

Brand & rebrand drift — assertions still pinned to upstream "Warp" copy
after the CastCodes rebrand.
- context_chips: format_git_branch error string updated to "CastCodes".
- settings_view::environments_page: section-header copy now expects
  "SHARED BY CASTCODES AND ...".

Cross-platform path handling — Linux/Windows tests broke on Unix-style
literals.
- ai::blocklist::handoff::touched_repos: swap `/repo` and `/repo/subdir`
  literals for a `cfg(windows)`-aware constant so `Path::is_absolute()`
  holds on every OS.
- lib launch_mode: gate `castcodes_app_bundle_executable_launches_gui`
  to `cfg(target_os = "macos")`; the bundle-detection branch it
  exercises is macOS-only (stub on Linux/Windows).

Drift from production-code changes (OSS/fork-local + harness gating).
- ai::blocklist::action_model::execute::start_agent: use "claude" so
  the local-harness child parses successfully and the test reaches the
  OrchestrationV2 gate it claims to exercise (the prior "codex"
  identifier no longer parses as a valid local-harness child).
- drive::import: refresh the `expand_dirs` snapshot to include the
  three test-data fixtures added since the test was last touched
  (tweakcn_sample_dark, tweakcn_sample_light, ui_block_theme).
- pane_group::test_start_shared_session_from_modal: temporarily
  override the channel to `Stable` for the duration of the test, since
  `open_share_session_modal` now early-returns on OSS channels where
  cloud services are unavailable. Adds a `#[cfg(feature = "test-util")]`
  `ChannelState::override_channel_for_test` RAII guard in warp_core for
  this; the production fork-local gate is preserved.
- auth::auth_manager::initialize_user_from_auth_payload: run CSRF
  state validation before the hosted-auth-disabled bail. The
  `should_silently_ignore_stale_redirect` and `InvalidStateParameter`
  paths are channel-agnostic — surfacing an invalid-state error from
  a redirect that smuggled in a mismatched token is still correct in
  the OSS build, and never touches the hosted backend. This restores
  `test_stale_state_when_logged_out_emits_invalid_state_parameter` and
  `test_mismatched_state_with_different_user_uid_emits_invalid_state_parameter`.

Verification: `cargo nextest run -p warp-app --no-fail-fast`
→ 4212 passed, 1 pre-existing failure
(`settings::init::tests::test_migration_does_not_rerun_when_marker_present`,
which reads `~/.cast-codes/settings.toml` from the real home dir and
fails on any machine that has used CastCodes — reproduces on `main`
unchanged). `cargo fmt --check` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@BunsDev BunsDev marked this pull request as ready for review May 30, 2026 18:48
Copilot AI review requested due to automatic review settings May 30, 2026 18:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@BunsDev BunsDev merged commit 6fc10f6 into main May 30, 2026
31 of 35 checks passed
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.

2 participants