Flashlight: working env, readiness on /admin-dev/, unique artifacts, per-version PR comments, module install - #10
Merged
Conversation
The PHP library (v1.7.1) reads its settings from $_ENV only, filled by phpdotenv from the first existing file among .env.local and .env (short-circuit: .env is never read once .env.local exists) in immutable mode. The action wrote a .env.local holding only FO_URL and PS_VERSION, so: - the lib fell back to its default back-office credentials (demo@prestashop.com), which do not exist on Flashlight; - the user's .env was silently ignored; - a PRESTAFLOW_* var passed with `env:` never reached $_ENV under variables_order=GPCS (setup-php default). Worse, since it is visible in $_SERVER, immutable phpdotenv also refused to load the same key from .env.local: the key ended up missing and the lib used its default. The action itself hit this with PRESTAFLOW_FO_URL, which it passed both in the composer env and in .env.local. The generated .env.local now layers, lowest to highest priority (later assignments win within one phpdotenv file): Flashlight BO credentials (admin@prestashop.com / prestashop), the user's dotenv file copied verbatim (.env.local if present, else .env), the Flashlight FO/BO URLs and PS version, then every PRESTAFLOW_* from the step env. Values are quoted for phpdotenv (single quotes are literal, so JSON for EXTRA_HEADERS / COOKIES is kept as is; double quotes with escapes otherwise). The keys written there are stripped from the composer process env. A pre-existing .env.local is restored after the run; otherwise the generated file is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Readiness was a 2xx/3xx on `/`. Flashlight's front answers as soon as the web server is up, so this only proved that something listened on the port, not that PHP and PrestaShop were serving: tests could start against a shop still running its post-install scripts. Flashlight renames the admin folder to the fixed `admin-dev`, which redirects (302) to the AdminLogin page once PrestaShop really serves (checked on the 1.7.8.11, 8.1.7 and 9.0.0 images). We now poll `<url>/admin-dev/` for a 302 (or 200), still with the 240s timeout. On timeout the error names the URL and the last status, and since no handle is returned to the caller, `docker compose logs` is printed and the stack is torn down before failing; previously the containers were left running and no logs were shown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The artifact was named prestaflow-report-<run>-<attempt>, identical for every job of a run. Artifact names must be unique within a run and @actions/artifact v2 has no overwrite (CreateArtifact answers 409 Conflict and uploadArtifact throws), so in a matrix only the first leg uploaded its results and screenshots; the others only logged a warning. The name now appends the job id (GITHUB_JOB), the PS version when Flashlight is on and the suites, with characters rejected by the artifact service replaced. Matrix values are not exposed to actions, so legs that still share all of these (e.g. a matrix on the PHP version) retry once under a random suffix instead of losing their artifact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment finder matched any comment starting with `<!-- prestaflow-run:` (or the legacy marker), whatever the project key: the "per-project" marker was written but never compared. Every job of a Flashlight matrix, and every project posting on the same PR, therefore updated the same comment and only the last one to finish stayed visible. The marker now includes the PS version when Flashlight is on (`<!-- prestaflow-run:<projectKey>:ps-<version> -->`), the title shows it, and the finder compares the whole marker line. Each version gets its own comment. A single comment with one section per version was rejected: the legs run concurrently and would have to read, merge and rewrite the same comment, and the GitHub API has no conditional update to make that race-free. Non-versioned markers can still take over the legacy `<!-- prestaflow-report -->` comment; versioned ones do not, so that concurrent legs never compete for it. Also fix the README opt-out example, which used a non-existent `comment` input instead of `pr-comment`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A composer `prestashop-module` was mounted in modules/<name> but never installed, so every user had to write a Flashlight init-script just to run `prestashop:module install`. New input `flashlight-install-module` (default true): once the shop is ready, run `php bin/console prestashop:module install <name>` in the container. Only for a composer prestashop-module mounted under modules/ (not themes, root mounts or the modules/<repo> fallback for unknown types). Checked on the 1.7.8.11, 8.1.7 and 9.0.0 Flashlight images: on an already installed module (e.g. by an init-script) PrestaShop runs an upgrade and reports the same success, so it does not break existing setups. The exit code is 0 even on failure on 8.1/9.0, so success is read from the output; a failure only warns, the tests then tell whether the module was needed. Co-Authored-By: Claude Opus 5.5 <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.
Defects found while running the PrestaFlow blog series and PrestaFlow/psflowdemo#1 against the Action. Each commit fixes one defect, adds a test that failed first, and rebuilds
dist/.npm run allpasses: lint, 16 suites / 108 tests, ncc build.6935b66flashlight: truethe Action wrote a.env.localholding onlyFO_URLandPS_VERSION, so phpdotenv ignored the repo's.env. The library's BO defaults (demo@prestashop.com) don't match Flashlight. Undervariables_order=GPCS(setup-php's default),env:never reached$_ENV. Fix: one merged.env.local, from lowest to highest priority: Flashlight BO credentials, then the user's.env.local/.env, then the shop-derivedFO_URL/BO_URL/PS_VERSION, then anyPRESTAFLOW_*from the step'senv:. Values are escaped for phpdotenv. An existing.env.localis restored afterwards. psflowdemo#1 failed because of this: BO URLnull, locale ignored.58b281e/admin-dev/instead of 200–399 on/. On timeout it printsdocker compose logs, tears down, and fails with the URL and the last status.cc6ee25b1b25dd<!-- prestaflow-run:prefix, so matrix jobs and even different projects overwrote one another. Now one comment per (project, PS version), with an exact marker match. One comment with a section per version was rejected: parallel read-merge-write races, since GitHub has no conditional update.1a644eeflashlight-install-module(defaulttrue) runsprestashop:module installfor a mountedprestashop-module. Tested on 1.7.8.11, 8.1.7 and 9.0.0. Re-running on an installed module upgrades it and succeeds. Success is read from the output, because the exit code is 0 even on failure in 8.1/9.0. A failure only warns.Behaviour changes for
@v2usersadmin@prestashop.com/prestashop. Credentials the user sets still win.env:on the step and the repo's.envnow work with Flashlight..env.localis removed after the run.flashlight-install-module: falseturns it off.Releasing
After merge: tag a minor version (new input plus behaviour changes, e.g.
v2.1.0), then movev2. psflowdemo uses@main, so it picks the fix up at merge.Not changed
PRESTAFLOW_*passed throughenv:still hides the same key of.envunder GPCS.suitesinput needs the library change in Runner reliability: waitForPageLoaded, exit codes, env, bin, --suites php-library#63.🤖 Generated with Claude Code