Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: locate Terraform entrypoint file#16753

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 2 commits intomainfrom16360-main-tf
Feb 28, 2025
Merged

fix: locate Terraform entrypoint file#16753

mtojek merged 2 commits intomainfrom16360-main-tf
Feb 28, 2025

Conversation

mtojek
Copy link
Member

Fixes:#16360

This PR updates the template version editor code to accurately identify the Terraform entrypoint file.

@mtojekmtojek self-assigned thisFeb 28, 2025
@mtojekmtojek marked this pull request as ready for reviewFebruary 28, 2025 13:51
Comment on lines +381 to +385
if (filename === defaultMainTerraformFile) {
initialFile = path;
skip = true;
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

What is the order in whichtraverse() will traverse the nodes offileTree? Are child paths sorted prior to being added to the frontier? In other words, if you have botha/main.tf andz/main.tf, which will get chosen? I know you have a test above, but is the output dependant on the ordering of the nodes? Is it just "first found wins"?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Let me expandtraverse() with sorting capabilities.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

nice 👍

@mtojekmtojek merged commit930816f intomainFeb 28, 2025
30 checks passed
@mtojekmtojek deleted the 16360-main-tf branchFebruary 28, 2025 14:22
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 28, 2025
@@ -90,7 +90,7 @@ export const TemplateVersionEditorPage: FC = () => {
// File navigation
// It can be undefined when a selected file is deleted
const activePath: string | undefined =
searchParams.get("path") ??findInitialFile(fileTree ?? {});
searchParams.get("path") ??findEntrypointFile(fileTree ?? {});
Copy link
Member

@ParkreinerParkreinerFeb 28, 2025
edited
Loading

Choose a reason for hiding this comment

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

Do you know what happens ifsearchParams.get returns an empty string or a string that isn't a valid filename?

That would short-circuit the nullish expression and preventfindEntrypointFile from ever being called, and as far as I can tell,activePath gets fed directly into the editor without any additional data massaging

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

nice catch! let me look into this 👍

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

// 1. If "main.tf" exists in root, return it.
// 2. Traverse through sub-directories.
// 3. If "main.tf" exists in a sub-directory, skip further browsing, and return the path.
// 4. If "main.tf" was not found, return the last reviewed "".tf" file.
Copy link
Member

Choose a reason for hiding this comment

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

With the sorting in place now, I feel like it would've helped to clarify what "last reviewed" means, especially to help make it clear that the tests are actually deterministic

Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@ParkreinerParkreinerParkreiner left review comments

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@mtojekmtojek

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Wrongmain.tf file can be auto-selected when opening template in built-in web editor
3 participants
@mtojek@johnstcn@Parkreiner

[8]ページ先頭

©2009-2025 Movatter.jp