Skip to content

Make CI trustworthy (PROC-01..05)#23

Open
enesemini wants to merge 6 commits into
developfrom
fix/ci-trust
Open

Make CI trustworthy (PROC-01..05)#23
enesemini wants to merge 6 commits into
developfrom
fix/ci-trust

Conversation

@enesemini

@enesemini enesemini commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Closes the PR-1 workstream from audit/REMEDIATION_PLAN.md (PR #22). Fixes PROC-01, PROC-02, PROC-03, PROC-04, PROC-05.

What changed

CI (run-tests.yml)

  • New test-parallel job mirroring how developers run the suite (composer test, i.e. pest --parallel). Serial-only CI hid every parallel-specific failure (PROC-01).
  • New fresh-install matrix job (PHP 8.2/8.3 × Laravel 11/12) doing a clean dependency resolve — the class of check that would have caught the months-long unsatisfiable composer.json on main (PROC-02). The plan said Laravel 10/11/12, but laravel/sanctum ^4.0 in require makes Laravel 10 unsatisfiable — the ^10.0 in require-dev is dead. Decide in PR-10: drop the claim or fix constraints.
  • Test + PHPStan jobs run on PHP 8.3: the harness needs pest-plugin-livewire v4 (PHP ^8.3), which is what pulls in Livewire 4 — the stack local dev runs and PR-5 commits to. On 8.2 the resolver falls back to Livewire 3 and the suite/analysis fail on LW-01..04 mismatches.
  • Workflows also trigger for develop (previously CI did not run on PRs targeting it at all).
  • Serial job runs pest --no-coverage: phpunit.xml.dist configures coverage reports and Pest 4 aborts (exit 1, zero tests) when they're requested without a coverage driver.

Parallel flakiness root fix (PROC-03)

Every ParaTest worker now boots from its own throwaway copy of the testbench skeleton (TestCase::applicationBasePath(), keyed by UNIQUE_TEST_TOKEN). Workers previously shared one skeleton and raced on:

  • generated migrations scanned by every worker's RefreshDatabase → random FileNotFoundException
  • app/Aura/Resources (generator-test cleanup vs. every boot's Aura::getAppResources() Finder scan) → random DirectoryNotFoundException, cross-worker resource registration
  • public/vendor, compiled Blade views, routes/, plugins/, skeleton composer.json

Narrower fixes don't work: useAppPath() breaks Application::getNamespace() (psr-4 lookup against composer.json). Serial runs keep the shared skeleton. The local skeleton had accumulated 79MB of test junk — cleaned; isolation prevents re-pollution.

Also: Aura::reset() clears mutable static state ($userModel) in the Pest afterEach.

Fixes the new CI immediately caught

  • composer.json config: policy.advisories.block: false — current Composer refuses to resolve framework versions with open advisories; EOL Laravel lines never get fixes, so every install failed. Root-package-only config; consumers' own policy is unaffected.
  • pest-plugin-livewire: ^3.0|^4.0^4.0 alone requires PHP ^8.3, contradicting the package's php: ^8.2 floor.
  • Fields\Datetime class-name case in CreateResourceMigration'Fields\DateTime' only autoloads on case-insensitive filesystems (macOS); the command and 4 tests failed on Linux.

PHPStan (PROC-05)

  • The workflow had been manually disabled in repo settings — re-enabled, now also runs on PRs and is manually dispatchable.
  • Committed baseline (1429 entries) so it fails on new errors only; burn-down per-area later.

Dependabot auto-merge (PROC-04)

  • main now has branch protection requiring the P8.3 - prefer-stable - ubuntu-latest check (set via API — previously no protection existed, so --auto merged immediately).
  • Follow-up after merge to main: add parallel - P8.3 - prefer-stable to the required checks.

CI state on this PR

  • fresh-install ×4, phpstan, code-style: ✅
  • serial + parallel suite: ❌ on exactly the 3 known deterministic failures — 2× ResourceEditor (LW-02, owned by PR-5) and 1× CreateTeam (PROC-08, owned by PR-6). Red is now meaningful; PR-5/PR-6 turn it green.

Validation

  • 8 consecutive local pest --parallel full-suite runs with only the 3 known failures.
  • composer analyse clean against the baseline.
  • phpunit-without-teams.xml failures (createSuperAdmin() creates a Team unconditionally) are pre-existing on develop — verified in a clean worktree; PR-6 scope.

🤖 Generated with Claude Code

- run-tests.yml: add a parallel job mirroring `composer test` and a
  fresh-install matrix job (PHP 8.2/8.3 x Laravel 11/12) that proves
  composer.json resolves from scratch; trigger on develop too.
- Parallel flakiness root fix: give every ParaTest worker its own
  throwaway copy of the testbench skeleton (TestCase::applicationBasePath).
  Workers previously shared one skeleton, racing on generated migrations
  (FileNotFoundException), the app/Aura resource scan
  (DirectoryNotFoundException), published assets, and compiled views.
- Aura::reset() clears mutable static state ($userModel) in the
  Pest afterEach alongside the existing singleton rebind.
- PHPStan: commit a baseline of the current errors so CI fails only
  on new ones; run the workflow on PHP 8.2 (8.1 cannot resolve deps)
  and on pull requests.
- dependabot-auto-merge: consolidate to one gated step; merge is held
  by the new required status check on main (set via branch protection).

Validation: 8 consecutive `pest --parallel` full-suite runs with only
the 3 known deterministic failures owned by PR-5/PR-6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
enesemini added a commit that referenced this pull request Jun 12, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
enesemini and others added 5 commits June 12, 2026 14:30
Recent Composer refuses to resolve framework versions with open
security advisories. EOL Laravel lines never get fixes, so the block
permanently excludes versions this package claims to support and every
CI job fails at install. Package-level config only applies when
aura-cms is the root package (development/CI); consumers' own advisory
policy is unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pest-plugin-livewire ^4.0 requires PHP ^8.3, contradicting the
package's php ^8.2 floor — caught by the new fresh-install CI job.
v3 pairs with the already-allowed Pest 3 on PHP 8.2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The workflow had been manually disabled in repo settings (the actual
PROC-05 'not failing CI'); re-enabled via gh. Add workflow_dispatch
and trigger on changes to the workflow file itself.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On PHP 8.2 the resolver falls back to pest-plugin-livewire v3 and thus
Livewire 3, and both the suite (Modals.php uses Livewire\Finder\Finder)
and PHPStan fail on LW-01..04 version mismatches that PR-5 owns. 8.3
yields the stack local development runs. Branch protection context
updated to the new check name. Also fix the fresh-install version
report step (composer show takes a single package).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The class file is Datetime.php; the hardcoded 'Fields\DateTime' only
autoloads on case-insensitive filesystems (macOS), so the command and
its tests failed on Linux — caught by the new parallel CI job. Serial
CI job also gets --no-coverage: phpunit.xml.dist configures coverage
reports and pest aborts without a driver.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant