Skip to content

Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release] - #637

Merged
snake14 merged 11 commits into
6.x-devfrom
PG-4897-hook-fixes
Sep 1, 2026
Merged

Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release]#637
snake14 merged 11 commits into
6.x-devfrom
PG-4897-hook-fixes

Conversation

@snake14

@snake14 snake14 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-up to #636: the pre-push hook now diffs against the merge base with origin/5.x-dev instead of the local 5.x-dev branch, which could be stale or missing and silently widened the analysis to files the push doesn't touch. It now fails with a clear message when the merge base can't be resolved.

The modified-files hook level is set to the plugin-wide goal of level 5 (the CI base stays at level 1), so files a push touches ratchet toward that goal rather than staying at the level CI enforces.

  • Newly created files are now checked at PHPStan level 9: new code carries no pre-existing debt, so it is held to the strictest level.

Tooling-only change: no version bump or changelog entry (no_release).

Issue No

Related to PG-4897 (JIRA)

Steps to Replicate the Issue

  1. Push a branch from a checkout whose local 5.x-dev is stale or missing.
  2. Expected: the pre-push hook analyses only the files the push touches.
  3. Actual: the hook diffed against the stale local branch and analysed unrelated files, or failed to resolve the branch entirely.

Checklist

  • [✔] Tested locally or on demo2/demo3?
  • [NA] New test case added/updated?
  • [NA] Are all newly added texts included via translation?
  • [NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue)
  • [NA] Version bumped?
  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules
  • [NA] Documentation updated?

@snake14 snake14 changed the title Diff against the merge base with origin/5.x-dev in the pre-push hook [no_release] Fix the pre-push hook base resolution and align its PHPStan level with CI [no_release] Aug 3, 2026
@snake14
snake14 requested a review from a team August 4, 2026 01:06
@snake14
snake14 removed the request for review from a team August 19, 2026 04:07
@snake14
snake14 marked this pull request as draft August 19, 2026 04:07
A higher level in the pre-push hook than in CI blocks pushes on pre-existing
errors in touched files that CI accepts.
New files carry no pre-existing debt, so hold them to the strictest level.
…lease]

Touched files are ratcheted up to level 5 even where the CI base is lower;
pre-existing findings in a touched file get fixed with the change that
touches it.
Uncommitted local changes were analyzed and could block a push for
files the push doesn't contain. Also corrects the hook's log label.
Pushing another local branch, or several refs at once, analysed the
checked-out branch instead of what was actually pushed.
A plugin cloned outside a Matomo checkout cannot be checked, which is
no reason to block its pushes.
The ~85-line workflow is now maintained centrally in
matomo-org/plugin-ci-workflows, so each caller passes only its plugin
name and any dependent plugins. The PHP version comes from the shared
default (matomo6_min_php), which is what this branch needs now that it
targets 6.x-dev.

Where a path is excluded that the shared workflow no longer creates -
github-action-tests/ lived inside the plugin only because the old
workflow checked it out there - it is marked optional, because PHPStan
treats a missing excludePath as a fatal config error rather than a
no-op.
@snake14
snake14 changed the base branch from 5.x-dev to 6.x-dev August 27, 2026 04:25
@snake14
snake14 force-pushed the PG-4897-hook-fixes branch from a664a6b to 909de5a Compare August 27, 2026 05:11
snake14 and others added 2 commits August 31, 2026 09:29
The vendored copy predated the MAIN_BRANCH derivation, so on a 6.x-dev plugin it
diffed against 5.x-dev, and it also lacked the ddev-running, NUL-safe-path and
renamed-file fixes.
@snake14
snake14 marked this pull request as ready for review August 31, 2026 03:44
@snake14
snake14 requested a review from a team August 31, 2026 03:53
@snake14
snake14 merged commit a0576cf into 6.x-dev Sep 1, 2026
15 checks passed
@snake14
snake14 deleted the PG-4897-hook-fixes branch September 1, 2026 02:25
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.

2 participants