Skip to content

Conversation

@Konboi
Copy link
Contributor

@Konboi Konboi commented Jun 18, 2025

The cli a.k.a launchable command is built for CI pipelines, so it doesn't stop pipelines when API calls fail.
But this means pipelines keep running even with wrong settings, making it hard to notice problems.

To fix this, we will make the pipeline stop when the workspace is in a special state.
We call this special state "fail fast mode".

This PR adds fail fast mode support to the CLI.

@launchable-app

This comment has been minimized.

@Konboi Konboi force-pushed the fail-fast-mode branch 2 times, most recently from 8bd879f to 7c8f7f2 Compare June 18, 2025 08:32
@Konboi Konboi requested a review from Copilot June 18, 2025 08:40

This comment was marked as outdated.

@Konboi Konboi changed the title Introudce fail fast mode validation Introduce fail fast mode Jun 20, 2025
@Konboi Konboi requested a review from Copilot June 24, 2025 08:36

This comment was marked as outdated.

@Konboi Konboi requested a review from Copilot June 25, 2025 06:40

This comment was marked as outdated.

@Konboi Konboi marked this pull request as ready for review June 25, 2025 08:17
@Konboi Konboi requested a review from ono-max June 25, 2025 08:17
@ono-max
Copy link
Contributor

ono-max commented Jun 26, 2025

Sorry for waiting for you. I'll review this PR by today.

sys.exit(1)


class FailFastModeValidator:
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this API is not Pythonic, so how about something like this: #1058

Copy link
Contributor Author

@Konboi Konboi Jun 27, 2025

Choose a reason for hiding this comment

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

Turn too many arguments into a data class.
Rename _print_errors to exit_if_errors.

OK, I'll fix them

Stop splitting the processing into the method, since it's harder to understand it.

This is intentional.
Right now, the validation logic is shared (with the record tests and the subset commands), so it may look like things are jut split for no reason.
However, the motivation is to make it easier to add method-specific validations in the future

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Thank you! I wanted to use @DataClass decorator, but it's only supported from Python 3.7 and above 😢

https://qiita.com/ttyszk/items/01934dc42cbd4f6665d2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Konboi Konboi requested a review from Copilot June 27, 2025 00:59
Copy link
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.

Pull Request Overview

Adds support for “fail fast mode” to the CLI so CI pipelines will stop immediately on certain API failures.

  • Introduces fail_fast_mode_validate and helpers to error out when invalid options are used in fast-fail mode.
  • Fetches workspace state (isFailFastMode) via the new LaunchableClient.is_fail_fast_mode(), caches it, and wires it into commands.
  • Replaces many click.echo(...), sys.exit patterns with warning_and_exit_if_fail_fast_mode to unify behavior.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
launchable/utils/fail_fast_mode.py Implements global cache and validation for fail-fast.
launchable/utils/launchable_client.py Adds is_fail_fast_mode() API and per-client cache.
launchable/commands/* Wires in fail-fast checks and replaces warnings/exits.
tests/utils/test_fail_fast_mode.py Adds tests for validation under fast-fail on/off.
tests/commands/**/* Updates request‐call indices to account for state fetch.
launchable/utils/tracking.py Switches to shared Command enum for tracking.

@Konboi Konboi requested a review from ono-max June 27, 2025 01:06
return False


def warning_and_exit_if_fail_fast_mode(message: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: warning is a noun, so I guess the verb, warn is better?

Suggested change
def warning_and_exit_if_fail_fast_mode(message: str):
def warn_and_exit_if_fail_fast_mode(message: str):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

based on feedback
@sonarqubecloud
Copy link

@Konboi Konboi merged commit 536cd00 into main Jun 30, 2025
15 checks passed
@Konboi Konboi deleted the fail-fast-mode branch June 30, 2025 02:03
@github-actions github-actions bot mentioned this pull request Jun 30, 2025
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.

3 participants