fix: write .env.local for phpdotenv + skip API upload when no results.json#7
Merged
Merged
Conversation
….json Root cause of 'Class Pages\v8\... not found' despite exporting PRESTAFLOW_PS_VERSION: the library reads via $_ENV['...'], which PHP only populates when variables_order includes 'E' — rarely the case in CI. The library relies on phpdotenv (Dotenv::createImmutable) to load .env / .env.local into $_ENV. Without one of those files, the process env vars are ignored. Fix: when Flashlight is on, write .env.local at the workspace root with PRESTAFLOW_FO_URL + PRESTAFLOW_PS_VERSION. Loaded first by phpdotenv (immutable), so it wins over any existing .env. Also: when no results.json was produced (composer crash), skip the API upload entirely and catch any residual error as a warning. The prior behaviour tried to upload an empty payload, got a 453 back, threw, and lost all subsequent reporting including the PR comment (which had otherwise been fixed to show the zero-state gracefully). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related fixes
1.
.env.localfor phpdotenvEven after v2.0.2 exported
PRESTAFLOW_PS_VERSION, the lib still crashed withClass "…Pages\\v8\\Front\\GuestTracking\\Page" not foundbecause the library reads via$_ENV['...'], which PHP only populates whenvariables_orderincludesE— rarely the case in CI. The library relies on phpdotenv (Dotenv::createImmutable) to load.env/.env.localinto$_ENV. Without either file, the process env vars are silently ignored.Fix: when Flashlight is on, write
.env.localat the workspace root withPRESTAFLOW_FO_URL+PRESTAFLOW_PS_VERSION..env.localis loaded first by phpdotenv (immutable), so it wins over any existing.env.2. Skip API upload when there's no results.json
Root cause of the recent
Request failed with status code 453on the smoke run: when composer crashes before producingresults.json, we were still callinguploadToApi(), which rejected the empty payload with 453. The exception then bypassed the rest of the reporting flow, so outputs came out empty — losing the PR comment fix from #5 that would have shown the zero-state gracefully.Fix: only call
uploadToApi()whenfindResultsJson()returns a path. And even then, wrap the call so a residual error becomes acore.warning, not a hard failure. Artifacts + outputs + PR comment still run.Reproduced from
Test plan
prestaflow-prestashop#2after merge — expect v9 Page resolution and non-empty outputs.🤖 Generated with Claude Code