Skip to content
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

Improve FAH create & delete #6726

Merged
merged 7 commits into from Feb 5, 2024
Merged

Improve FAH create & delete #6726

merged 7 commits into from Feb 5, 2024

Conversation

inlined
Copy link
Member

@inlined inlined commented Jan 30, 2024

  1. Create now sets deployment-tool so we can track where users are coming from
  2. Create now sets a rollout policy like the Console
  3. Delete now works
  4. Delete no longer makes buildId required

1. Create now sets deployment-tool so we can track where users are
   coming from
2. Create now sets a rollout policy like the Console
3. Delete now works
4. Delete no longer makes buildId required
@inlined inlined requested a review from bkendall January 30, 2024 02:27
@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2024

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (c7fbe64) 54.19% compared to head (3f993de) 54.17%.

Files Patch % Lines
src/gcp/apphosting.ts 0.00% 7 Missing ⚠️
src/init/features/apphosting/index.ts 14.28% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6726      +/-   ##
==========================================
- Coverage   54.19%   54.17%   -0.02%     
==========================================
  Files         347      347              
  Lines       24154    24163       +9     
  Branches     4992     4994       +2     
==========================================
+ Hits        13090    13091       +1     
- Misses       9865     9873       +8     
  Partials     1199     1199              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -47,21 +45,27 @@ export const command = new Command("apphosting:backends:delete")
});
}

let backend: apphosting.Backend;
if (backendId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, this is odd. According to the approved proposal, the backend ID is supposed to be a required parameter, not a flag. That eliminates the need to pick a backend at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

Irrespective of the proposal, do you like this better? It seemed odd to me that location could be browsed but backend couldn't. If you like this better we can push it through API council. As an EAP API, do you feel like it is OK to release and then get approval, or should I splice this into another CL until after approval?

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally don't like it better, because I hate the prompt selector flow in a CLI 🤷‍♂️ It's not a wrong thing to do, but I'm assuming that there were product discussions that brought us to the API proposal (as that's a requirement at the top of the document) and that the pattern in the proposal was agreed upon by all the relevant stakeholders already. If you'd like to make a change to what was proposed there, starting back in the process, involving the right people, and getting an addendum would be appropriate.

That said, I thought the general pattern was to:

  1. require backendID as a parameter in the command
  2. default to looking at us-central1 as we 'traditionally' have

If someone is outside of us-central1, they get to include the --location flag.

Having this flow also makes it more complex. Sticking with the picker, you have to also consider what happens in non-interactive environment (like a CI system). As written, this would hang, I believe, which may be unexpected (instead of simply failing out).

Copy link
Member Author

Choose a reason for hiding this comment

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

🫡 I'll move the changes into another branch and bring up the idea in the devx room

Copy link
Member Author

Choose a reason for hiding this comment

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

(If it's chosen that we should keep the existing dialog, I agree that we need to check for nonInteractive)

};

it("should createBackend", async () => {
it("should createBackend with rollout policy", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nothing here tests to make sure the rollout policy was called. Please add the appropriate logic here to test for that

Copy link
Member Author

Choose a reason for hiding this comment

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

I may need to revert the label. I originally wrote the test to exercise this but realized it was for a smaller utility function and the larger flow is completely untested. I can either:

  1. Move creation of the rollout policy into a utility function and test it. This would be a trivial whitebox test that is unlikely to catch anything though.
  2. Add a new test that covers the overall flow of the entiere init process.
  3. Cry that init functions are generally sparsely tested in this codebase.

You make the call and I'll follow.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yeah, this isn't actually testing doSetup. Probably just revert the test name then. init function coverage is kinda a known weak point.

@inlined inlined requested a review from bkendall February 1, 2024 16:56
@@ -47,21 +45,27 @@ export const command = new Command("apphosting:backends:delete")
});
}

let backend: apphosting.Backend;
if (backendId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally don't like it better, because I hate the prompt selector flow in a CLI 🤷‍♂️ It's not a wrong thing to do, but I'm assuming that there were product discussions that brought us to the API proposal (as that's a requirement at the top of the document) and that the pattern in the proposal was agreed upon by all the relevant stakeholders already. If you'd like to make a change to what was proposed there, starting back in the process, involving the right people, and getting an addendum would be appropriate.

That said, I thought the general pattern was to:

  1. require backendID as a parameter in the command
  2. default to looking at us-central1 as we 'traditionally' have

If someone is outside of us-central1, they get to include the --location flag.

Having this flow also makes it more complex. Sticking with the picker, you have to also consider what happens in non-interactive environment (like a CI system). As written, this would hang, I believe, which may be unexpected (instead of simply failing out).

};

it("should createBackend", async () => {
it("should createBackend with rollout policy", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yeah, this isn't actually testing doSetup. Probably just revert the test name then. init function coverage is kinda a known weak point.

@inlined inlined requested a review from bkendall February 2, 2024 23:33
@inlined
Copy link
Member Author

inlined commented Feb 2, 2024

Controversial UX changes have been removed and test name has been reverted. PTAL.

@@ -197,10 +197,20 @@ export interface RolloutPolicy {
// end oneof trigger
stages?: RolloutStage[];
disabled?: boolean;

// TODO: This will be undefined if disabled is not true, right?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it should be.

@inlined inlined enabled auto-merge (squash) February 5, 2024 22:59
@inlined inlined merged commit 1473c04 into master Feb 5, 2024
36 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.

None yet

3 participants