Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[AssetMapper] Add logical failure implementation #58275

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

Open
wants to merge 7 commits into
base: 7.3
Choose a base branch
from

Conversation

wotta
Copy link

@wotta wotta commented Sep 16, 2024

Q A
Branch? 7.2
Bug fix? no
New feature? yes
Deprecations? no
License MIT

The following feature/change is to make sure we can rely on the correct status codes in the CI/CD pipelines.
Whenever the download part fail now we get the correct failure status code.

Incase things are missing please let me know, Not sure if any additional information is needed since this seems like a small change which appears to be pretty clear.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.2" but it seems your PR description refers to branch "7.2 for features / 5.4, 6.4, and 7.1 for bug fixes".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@carsonbot carsonbot changed the title feat: Added logical failure implementation [AssetMapper] feat: Added logical failure implementation Sep 16, 2024
@smnandre
Copy link
Member

As there is already a LogicException availabe in AssetMapper, maybe we should use it instead of the global one ?
It would allow you to target more specifically the exceptions catched here.

For instance (some others in the class / related ones):

foreach ($remoteEntriesToDownload as $package => $entry) {
if (!isset($contents[$package])) {
throw new \LogicException(\sprintf('The package "%s" was not downloaded.', $package));
}

I dont think this would be a BC break (cc @stof ?)

@OskarStark OskarStark changed the title [AssetMapper] feat: Added logical failure implementation [AssetMapper] Add logical failure implementation Sep 17, 2024
@wotta wotta requested a review from xabbuh September 19, 2024 12:33
@wotta
Copy link
Author

wotta commented Sep 26, 2024

I added additional exceptions to be catch'ed. Reason for this is because our pipeline was failing again with the following error. The added exceptions stopped the script from continuing which is what we need to not break our pipeline.

#28 70.49 [2024-09-25T17:41:43.741652+02:00] console.CRITICAL: Error thrown while running command "importmap:install". Message: "Idle timeout reached for "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf"." {"exception":"[object] (Symfony\\Component\\HttpClient\\Exception\\TimeoutException(code: 0): Idle timeout reached for \"https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf\". at /var/www/html/vendor/symfony/http-client/Chunk/ErrorChunk.php:61)","command":"importmap:install","message":"Idle timeout reached for \"https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf\"."}
#28 70.50 17:41:43 CRITICAL  [console] Error thrown while running command "importmap:install". Message: "Idle timeout reached for "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf"." ["exception" => Symfony\Component\HttpClient\Exception\TimeoutException { …},"command" => "importmap:install","message" => "Idle timeout reached for "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf"."]

@wotta
Copy link
Author

wotta commented Sep 27, 2024

Good morning @smnandre / @xabbuh.

Hope y'all are doing well. Do you happen to know how long it will take before the PR is going to be reviewed again?
I'll be able to communicate and manage expectations internally over here.

Thank you and I wish you an amazing day!

@wotta
Copy link
Author

wotta commented Sep 27, 2024

Unsure why the tests are failing here. Error: Cannot instantiate abstract class Twig\Node\Node

@wotta wotta requested a review from xabbuh September 27, 2024 11:40
Comment on lines +75 to +79
try {
$contents = $this->packageResolver->downloadPackages($remoteEntriesToDownload, $progressCallback);
} catch (TimeoutException|TransportException $exception) {
throw new LogicException($exception->getMessage());
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a good idea, as it's hiding the real exception. Also, this is not a "Logic" exception.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I understand but how would y'all like to see this in that case. It's hard to guess what direction I need to go with this.

Again I'm new to the Symfony world and just want to fix this specific issue because it is breaking deployments. And while I want to fix it I do want to do it while communicating.

Let me know if you have any thoughts on how to improve things. Have a nice evening!

@smnandre
Copy link
Member

I added additional exceptions to be catch'ed. Reason for this is because our pipeline was failing again with the following error. The added exceptions stopped the script from continuing which is what we need to not break our pipeline.

#28 70.49 [2024-09-25T17:41:43.741652+02:00] console.CRITICAL: Error thrown while running command "importmap:install". Message: "Idle timeout reached for "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf"." {"exception":"[object] (Symfony\\Component\\HttpClient\\Exception\\TimeoutException(code: 0): Idle timeout reached for \"https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf\". at /var/www/html/vendor/symfony/http-client/Chunk/ErrorChunk.php:61)","command":"importmap:install","message":"Idle timeout reached for \"https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf\"."}
#28 70.50 17:41:43 CRITICAL  [console] Error thrown while running command "importmap:install". Message: "Idle timeout reached for "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf"." ["exception" => Symfony\Component\HttpClient\Exception\TimeoutException { …},"command" => "importmap:install","message" => "Idle timeout reached for "https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/webfonts/fa-solid-900.ttf"."]

Pure curiosity, is it always the same files that trigger the exceptions ? Does some http client tuning limit the problem ?

@wotta
Copy link
Author

wotta commented Sep 27, 2024

Pure curiosity, is it always the same files that trigger the exceptions ? Does some http client tuning limit the problem ?

Great question! So the answer might be a bit useless but it's not always the same.

A month or maybe a bit more ago jsdelivr had issues. Not fully sure but I thought that was a certificate issue. That broke the deployments because import map didn't stop.

And every now and then the script fails without saying it went wrong because of timeouts, and or issues on jsdelivr's end. It is definitely not consistent but our issue can be easily solved if the import map script just returns the failure signal on error.

With on error I mean if anything halts the download process basically.

@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants