Skip to content

Code to create emulators.yaml uses backend root not project root#8412

Merged
inlined merged 3 commits intomasterfrom
inlined.emulator-init-fix
May 1, 2025
Merged

Code to create emulators.yaml uses backend root not project root#8412
inlined merged 3 commits intomasterfrom
inlined.emulator-init-fix

Conversation

@inlined
Copy link
Copy Markdown
Member

@inlined inlined commented Apr 8, 2025

Quicker fix than I realized.

We may want to re-add some of the previous behavior to detect multiple environments and determine which to use as the base config. I was more focused on making breaking changes before the major release, but that was interesting/useful, esp if people only have apphosting[.environment].yaml and not a generic apphosting.yaml.

That might require more though though as we may want to consolidate backendRoot/apphosting.mybackend.yaml and /apphosting.yaml for mult-backend setups.

@inlined inlined requested review from annajowang, joehan and mathu97 April 8, 2025 06:41
@inlined
Copy link
Copy Markdown
Member Author

inlined commented Apr 8, 2025

NOTE: This PR is part of my chain for debugging cursor glitches, but if approved, I'll probably rebase onto next directly, commit there, and then re-pull it into inlined.inquirer.

@inlined inlined force-pushed the inlined.emulator-init-fix branch from d46c95f to f1292ad Compare April 8, 2025 17:06
@inlined inlined changed the base branch from inlined.inquirer to next April 8, 2025 17:06
// Even if the app is in /project/app, the user might have their apphosting.yaml file in /project/apphosting.yaml.
// Walk up the tree to see if we find other local files so that we can put apphosting.emulator.yaml in the right place.
const basePath = dynamicDispatch.discoverBackendRoot(repoRoot) || repoRoot;
const basePath = dynamicDispatch.discoverBackendRoot(backendRoot) || backendRoot;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const basePath = dynamicDispatch.discoverBackendRoot(backendRoot) || backendRoot;
const basePath = dynamicDispatch.discoverBackendRoot(backendRoot) ?? backendRoot;

Nit: IIUC, ?? is preferred over || for undefined fallbacks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I personally prefer a style where you only use ?? when you know null and/or 0 is a valid value.

@inlined inlined changed the base branch from next to master May 1, 2025 15:49
@inlined inlined force-pushed the inlined.emulator-init-fix branch from 6dbdd66 to b07c42c Compare May 1, 2025 15:52
@inlined inlined enabled auto-merge (squash) May 1, 2025 15:53
@inlined inlined merged commit f8eab0b into master May 1, 2025
50 checks passed
blidd-google pushed a commit that referenced this pull request May 12, 2025
* Use backend root, not project root to initilaize apphosting.emulators.yaml

* Changelog & lint

* Update CHANGELOG.md

Co-authored-by: joehan <joehanley@google.com>

---------

Co-authored-by: joehan <joehanley@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants