Skip to content

Conversation

@josephperrott
Copy link
Member

Move the warnings processing before the initial processing of golden file and approval to always include its output. Additionally, provide alternate text output for approval attempts when no golden exists.

…ings and golden existence check

Move the warnings processing before the initial processing of golden file and approval to always include its output.  Additionally,
provide alternate text output for approval attempts when no golden exists.
@josephperrott josephperrott added the action: merge The PR is ready for merge by the caretaker label Feb 19, 2025
Log.warn(` Please rerun with "--warnings" to inspect unresolved imports.`);
}

if (goldenFile) {
Copy link
Member

Choose a reason for hiding this comment

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

NIt: I'd prefer if we guard by approve at the first condition, as that would make it easier to follow IMO.

(maybe that's just me though)

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 think that going based on the golden makes sense because its essentially shortcutting the rest of the logic below when no golden exists.

I reordered some things that I think end sup making it a bit better, let me know what you think.

);
return 1;
}
if (cycles.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be outside? What if there is a goldenFile and cycles?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is within the goldenFile being undefined so there is no golden file.

Copy link
Member

Choose a reason for hiding this comment

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

But shouldn't this fail? if there are cycles and goldenFile being !== undefined?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it will happen automatically below with the comparison. That's the thing I missed. Very confusing :D

Copy link
Member Author

Choose a reason for hiding this comment

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

For the case where there is no golden file, and there are cycles here. This fails as it returns a 1 as the exit code.

For cases where there is a golden file to do the comparison to later, we check the specifics.

return 0;
}

if (!existsSync(goldenFile)) {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this always exist after writing before?

Copy link
Member Author

Choose a reason for hiding this comment

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

The file would only be guaranteed to be written to, if an approval happened. If its a regular check, then it wouldn't be written in the block above, and could technically not exist. We verify it exists because just below here we read from it to do the actual comparison.

);
return 1;
}
if (cycles.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I guess it will happen automatically below with the comparison. That's the thing I missed. Very confusing :D

@josephperrott
Copy link
Member Author

This PR was merged into the repository by commit 0ad6a37.

The changes were merged into the following branches: main

@josephperrott josephperrott deleted the circ-deps branch February 19, 2025 20:27
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants