Skip to content

[#315] Removed the 'tmpDir' override pinning the PHPStan cache to '.artifacts'. - #329

Merged
AlexSkrypnyk merged 1 commit into
developfrom
feature/315-phpstan-tmpdir
Sep 8, 2026
Merged

[#315] Removed the 'tmpDir' override pinning the PHPStan cache to '.artifacts'.#329
AlexSkrypnyk merged 1 commit into
developfrom
feature/315-phpstan-tmpdir

Conversation

@AlexSkrypnyk

Copy link
Copy Markdown
Member

Closes #315

Summary

phpstan.neon no longer sets tmpDir, so vendor/bin/phpstan writes its result cache to PHPStan's default sys_get_temp_dir()/phpstan inside the cli container rather than to the repo-relative .artifacts/phpstan.

.artifacts/ is the project's disposable build-output tree, gitignored wholesale at .gitignore:51 and written to by test runs, screenshots and CodeRabbit scratch, so any cleanup of that directory also deleted resultCache.php and the next analysis silently restarted cold with no signal that the cache had gone. The line was never a deliberate choice: git log -S tmpDir -- phpstan.neon traces it to exactly one commit, cb38d59, where it was bundled into an unrelated AI alt-text feature PR alongside the ProviderProxy::chat() ignore rule that feature actually needed.

After merge ahoy cli vendor/bin/phpstan and the CI step at build-test-deploy.yml:146 both run unchanged, .artifacts/phpstan/ is never recreated, and the file matches the upstream Vortex template, which sets no tmpDir. Nothing else in phpstan.neon moves: the scripts/composer/ScriptHandler.php exclusion and the ProviderProxy::chat() ignore rule are deliberate project rules and stay, and .gitignore is untouched because its .artifacts entry is a blanket rule serving many consumers.

Before / After

BEFORE                                    AFTER
──────                                    ─────

ahoy cli vendor/bin/phpstan               ahoy cli vendor/bin/phpstan
           │                                         │
           ▼                                         ▼
 tmpDir: .artifacts/phpstan                (no tmpDir set)
           │                                         │
           ▼                                         ▼
┌────────────────────────────┐            ┌────────────────────────────┐
│ .artifacts/     DISPOSABLE │            │ sys_get_temp_dir()/phpstan │
│  ├─ logs/                  │            │  ├─ cache/                 │
│  ├─ coderabbit/            │            │  └─ resultCache.php        │
│  ├─ pr-screenshots/        │            │                            │
│  └─ phpstan/   <-- cache   │            │  container-local, created  │
│      ├─ cache/             │            │  on demand                 │
│      └─ resultCache.php    │            └────────────────────────────┘
└────────────────────────────┘                         │
           │                                           │
           ▼                                           ▼
 rm -rf .artifacts                          rm -rf .artifacts
           │                                           │
           ▼                                           ▼
 cache destroyed                            cache untouched
           │                                           │
           ▼                                           ▼
 next run: 153 files cold (15.4s),          next run: cache reused (3.9s)
 with nothing reported

Checklist before requesting a review

  • Subject includes ticket number as [#123] Verb in past tense.
  • Ticket number #123 added to description
  • Added context in Changed section
  • Self-reviewed code and commented in commented complex areas.
  • Added tests for fix/feature.
  • Relevant tests run and passed locally.

The tests box is left unticked deliberately. The change alters where a third-party tool writes its cache, so there is nothing project-owned to assert against; a test pinning PHPStan's resolved tmpDir would be testing PHPStan's defaults rather than this repo, and would break on any upstream change to them. The acceptance criteria in the issue are behavioural, so the verification below is behavioural. ahoy lint and ahoy test-unit (369 tests, 1145 assertions) both pass locally.

Changed

  1. phpstan.neon - removed the tmpDir: .artifacts/phpstan line and its trailing blank line, leaving level and phpVersion adjacent as they are upstream. This two-line deletion is the entire diff; no other file changes.

Verification

  • Baseline on develop: [OK] No errors across 153 files, cache populated at .artifacts/phpstan/ (resultCache.php, 2.7 MB).
  • Deleted .artifacts/phpstan/, then ran ahoy cli vendor/bin/phpstan cold: [OK] No errors in 15.4s, with no error about a missing cache directory.
  • Confirmed .artifacts/phpstan/ was not recreated.
  • Immediate warm run: [OK] No errors in 3.9s. The drop from 15.4s to 3.9s is the evidence that the cache repopulated at the default location and is being read back.

Checked for dead references

The issue asks whether anything now depends on the override. Nothing does.

  • grep -rn "artifacts/phpstan" across the repo returns only the removed line itself.
  • .gitignore has no phpstan entry. It ignores .artifacts wholesale at line 51, a blanket rule that predates the override, so no entry becomes dead.
  • .github/workflows/build-test-deploy.yml:146 invokes PHPStan with no cache key, no actions/cache step, and no cleanup step naming the path. CI runs were always cold and are unaffected.

Screenshots

N/A - the diff touches only phpstan.neon, a static-analysis config file Drupal never loads at runtime. Nothing rendered changes.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 12 days. After that, they cost $0.25 per reviewed file.

Or wait 16 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 32e988ee-82c2-490a-99fa-c4132d0c4720

📥 Commits

Reviewing files that changed from the base of the PR and between 06c6a8d and dd1a116.

📒 Files selected for processing (1)
  • phpstan.neon

Comment @coderabbitai help to get the list of available commands.

@AlexSkrypnyk AlexSkrypnyk added A2 Board worker 2 AUTOMERGE Pull request has been approved and set to automerge labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Code coverage (threshold: 80%)

  Classes: 51.85% (14/27)
  Methods: 77.17% (71/92)
  Lines:   89.15% (756/848)
Per-class coverage
Drupal\do_ai_alt_text\AltTextGenerator
  Methods:  85.71% ( 6/ 7)   Lines:  98.72% ( 77/ 78)
Drupal\do_ai_alt_text\Plugin\Action\RegenerateImageAltText
  Methods: 100.00% ( 8/ 8)   Lines: 100.00% ( 63/ 63)
Drupal\do_base\EventSubscriber\PreviewLinkCacheSubscriber
  Methods:  33.33% ( 1/ 3)   Lines:  11.11% (  1/  9)
Drupal\do_base\EventSubscriber\ThemeColorSubscriber
  Methods:  66.67% ( 2/ 3)   Lines:  40.00% (  4/ 10)
Drupal\do_base\Hook\AutomatedListPagerHook
  Methods: 100.00% ( 5/ 5)   Lines: 100.00% ( 31/ 31)
Drupal\do_base\Hook\LibraryInfoAlterHook
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% (  9/  9)
Drupal\do_base\Hook\MetatagsAlterHook
  Methods: 100.00% ( 7/ 7)   Lines: 100.00% ( 58/ 58)
Drupal\do_base\Hook\PageAttachmentsHook
  Methods:  87.50% ( 7/ 8)   Lines:  94.92% ( 56/ 59)
Drupal\do_base\NavigationScriptHash
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 27/ 27)
Drupal\do_base\Twig\ImageDimensionsExtension
  Methods:  40.00% ( 2/ 5)   Lines:  81.48% ( 44/ 54)
Drupal\do_content_api\EventSubscriber\JsonApiWriteGateSubscriber
  Methods:  66.67% ( 2/ 3)   Lines:  88.89% (  8/  9)
Drupal\do_content_api\Hook\EntityCreateAccessHook
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 12/ 12)
Drupal\do_content_api\Hook\ModerationPolicyHook
  Methods:  50.00% ( 1/ 2)   Lines:  93.75% ( 15/ 16)
Drupal\do_content_api\Routing\RouteSubscriber
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  6/  6)
Drupal\do_feed\FeedUrlBuilder
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 18/ 18)
Drupal\do_feed\Form\FeedSettingsForm
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 15/ 15)
Drupal\do_feed\Hook\EntityDeleteHook
  Methods:  50.00% ( 1/ 2)   Lines:  92.31% ( 12/ 13)
Drupal\do_feed\Hook\EntityPresaveHook
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% ( 54/ 54)
Drupal\do_feed\Hook\PreprocessParagraphHook
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 14/ 14)
Drupal\do_feed\Hook\PreprocessViewsViewRowRssHook
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  3/  3)
Drupal\do_feed\Hook\ViewsPreViewHook
  Methods:  50.00% ( 1/ 2)   Lines:  96.43% ( 27/ 28)
Drupal\do_generated_content\Generator\CaseMatrix
  Methods: 100.00% ( 3/ 3)   Lines: 100.00% ( 12/ 12)
Drupal\do_generated_content\Generator\RelativeDate
  Methods: 100.00% ( 1/ 1)   Lines: 100.00% (  1/  1)

@AlexSkrypnyk
AlexSkrypnyk enabled auto-merge (squash) September 8, 2026 07:31
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.56%. Comparing base (06c6a8d) to head (dd1a116).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #329   +/-   ##
========================================
  Coverage    86.56%   86.56%           
========================================
  Files           28       28           
  Lines          655      655           
========================================
  Hits           567      567           
  Misses          88       88           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk
AlexSkrypnyk merged commit 1ba84c0 into develop Sep 8, 2026
11 checks passed
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/315-phpstan-tmpdir branch September 8, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A2 Board worker 2 AUTOMERGE Pull request has been approved and set to automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the PHPStan cache out of '.artifacts/phpstan' back to the default location

2 participants