-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add --attach/--detach options to fal deploy #1100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Minor UX nit: for app-name references (e.g.
fal deploy my-app --attach), the CLI's--strategyis silently discarded by_resolve_deployment_reference—get_app_data_from_tomloverwrites the AppData, and onlyattach_to_deploymentis re-applied viareplace(). Ifpyproject.tomlsetsdeployment_strategy = "recreate", users who runfal deploy my-app --strategy rolling --attachsee this error telling them to "Use --strategy rolling" — which they already did. The "remove the attach flag" half still applies, but the--strategyhalf is misleading in this narrow case.Extended reasoning...
The scenario
When a user passes an app-name reference (single positional arg matching an entry in
pyproject.toml),_resolve_deployment_referenceinprojects/fal/src/fal/api/deploy.pybuilds an initialAppDatafrom CLI flags at line 122–128, then at line 145 does:The assignment completely replaces the CLI-populated
AppDatawith the TOML version. Onlyattach_to_deploymentis subsequently re-applied viareplace()—deployment_strategy,auth,reset_scale, etc. from the CLI are discarded.Concrete proof
pyproject.toml:User runs:
fal deploy my-app --strategy rolling --attachStep-by-step:
argparseparsesargs.strategy = "rolling"andargs.attach_to_deployment = True._deploycallsprepare_deployment(..., strategy="rolling", attach_to_deployment=True)._resolve_deployment_referencebuilds initialAppData(deployment_strategy="rolling", attach_to_deployment=True, ...).is_app_name(("my-app", None))returns True.app_data = get_app_data_from_toml("my-app")returnsAppData(deployment_strategy="recreate", attach_to_deployment=None, ...)— CLI--strategyvalue is gone.replace(app_data, attach_to_deployment=True)restores just the attach flag.app_data.deployment_strategy == "recreate",app_data.attach_to_deployment is True._validate_attach_to_deployment(line 163) seesstrategy = "recreate"and raises: "--attach/--detach only applies to rolling deployments. Use --strategy rolling or remove the attach flag."--strategy rolling. The advice is a dead end — they must editpyproject.toml.Why this matters (and why it's a nit)
The "or remove the attach flag" half of the message is still actionable, so the user is not fully stuck. But the
--strategy rollingsuggestion sends them chasing a fix they already applied, which will make the underlying quirk (CLI--strategysilently ignored for app-name refs) more visible and confusing than before.Addressing a refutation raised in verification: the objection is that this scenario requires all three conditions (app-name ref + TOML
deployment_strategy = "recreate"+--attach), and that the underlying CLI-vs-TOML precedence is pre-existing behavior not introduced by this PR. Both points are accurate — this is why the finding is filed as a nit rather than blocking. What is new in this PR is the validation that surfaces the mismatch as an error, so this is the natural moment to make the message match the actual fix path.Suggested fixes
Either would resolve it — both are follow-up polish, not merge blockers:
pyproject.tomldeployment_strategytakes precedence for app-name refs, e.g.: "Use --strategy rolling (or setdeployment_strategy = \"rolling\"in pyproject.toml when using an app-name reference) or remove the attach flag."--strategyoverride the TOML value for app-name refs by addingif strategy != "rolling": app_data = replace(app_data, deployment_strategy=strategy)alongside the existingattach_to_deploymentoverride at line 146–147. This would be consistent with how the PR handles--attachitself.