Bug 41274 - Incremental test runs not properly skipping Schema files
Summary: Incremental test runs not properly skipping Schema files
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low blocker
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-19 17:09 UTC by Martin Renvoize (ashimema)
Modified: 2025-11-20 14:02 UTC (History)
2 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41274: Koha::Devel::Files - Fix exception filtering in incremental mode (3.29 KB, patch)
2025-11-19 17:11 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 41274: Remove range parameter from ls_perl_files (2.41 KB, patch)
2025-11-20 14:01 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41274: Remove the exceptions from git range (2.20 KB, patch)
2025-11-20 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41274: Remove exceptions from files listed in the result repo (1.11 KB, patch)
2025-11-20 14:02 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2025-11-19 17:09:55 UTC
The incremental test runs Koha::Devel::Files module is failing to skip the DBIx::Class generated Schema files
Comment 1 Martin Renvoize (ashimema) 2025-11-19 17:11:00 UTC
Created attachment 189716 [details] [review]
Bug 41274: Koha::Devel::Files - Fix exception filtering in incremental mode

This patch fixes two bugs in the file exception filtering logic that
caused generated files (like Koha/Schema/Result/*) to not be excluded
properly when running in incremental/CI mode.

Bug #1: Incorrect array assignment
Lines 173 and 204 were assigning an arrayref as a single element
instead of dereferencing it:
  my @exception_files = $exceptions->{...};  # Wrong: creates array with 1 element (arrayref)
  my @exception_files = @{ $exceptions->{...} };  # Correct: dereferences to array

Bug #2: Pattern matching not supported
array_minus() only performs exact string matches, so patterns like
"Koha/Schema/Result" would not match "Koha/Schema/Result/Aqbasket.pm".

The fix:
- Properly dereferences exception patterns array
- Replaces array_minus with grep + regex pattern matching
- Uses /^\Q$_\E/ to match file paths starting with exception patterns
- Removes now-unused Array::Utils dependency

This ensures consistent behavior between:
- Non-incremental mode: Uses git ls-files with :(exclude) patterns
- Incremental mode: Now uses equivalent pattern matching

Test plan:
1. Run tests locally (non-incremental): prove xt/perltidy.t
2. Verify Schema files are excluded
3. Run in CI (incremental mode) with Schema file changes
4. Verify Schema files are now correctly excluded (previously failing)
Comment 2 Jonathan Druart 2025-11-20 13:52:48 UTC
Related to https://gitlab.com/koha-community/koha-testing-docker/-/merge_requests/562

Without we cannot test locally.
Comment 3 Jonathan Druart 2025-11-20 14:01:48 UTC
Created attachment 189776 [details] [review]
Bug 41274: Remove range parameter from ls_perl_files

It's not used.
Comment 4 Jonathan Druart 2025-11-20 14:02:01 UTC
Created attachment 189777 [details] [review]
Bug 41274: Remove the exceptions from git range

When listing the files from a git range we want to remove the exception
files from that list
Comment 5 Jonathan Druart 2025-11-20 14:02:13 UTC
Created attachment 189778 [details] [review]
Bug 41274: Remove exceptions from files listed in the result repo

IF we have pushed some files that should have been excluded from the
tests but have been processed previously and failed, we should skip it
the next build anyway