Skip to content

test(#3432653): cover the migration path that reported the crash - #26

Open
Decipher wants to merge 1 commit into
8.x-1.xfrom
feature/3432653-scheme-guard
Open

test(#3432653): cover the migration path that reported the crash#26
Decipher wants to merge 1 commit into
8.x-1.xfrom
feature/3432653-scheme-guard

Conversation

@Decipher

@Decipher Decipher commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Refs https://www.drupal.org/project/filefield_paths/issues/3432653

Summary

Test-only. The reported fatal is already fixed by the object oriented conversion; this adds the regression coverage that was never written.

Why there is no fix here

The crash was Call to a member function getType() on bool at filefield_paths.inc:75. The old code resolved stream wrappers with StreamWrapperManager::getViaUri(...)->getType(), and getViaUri() returns FALSE for a scheme no wrapper handles. That file is now a deprecation stub that nothing loads, and the replacement never calls a method on a wrapper lookup: it parses the scheme and guards with empty() before use.

Verification

Both reporters hit this during a migration, so the coverage goes in at that layer rather than by calling the service directly:

  • MigrateMediaFileTest runs a real MigrateExecutable over an embedded_data source into entity:media, so the hook fires from hook_entity_insert inside a migration, and asserts the import returns RESULT_COMPLETED.
  • The second case sets temp_location to an unregistered scheme, which is the reporter's environment, and asserts up front that the scheme really has no wrapper so the test cannot pass vacuously.
  • FileFieldPathsProcessFileLegacyTest::testUnregisteredTemporarySchemeIsSkipped covers the same input at service level.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when processing files during media migrations.
    • File processing now safely handles unregistered temporary storage schemes without causing fatal errors.
    • Migrated media files are successfully processed and moved to their configured destination.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dbcae803-03b5-4b75-a021-f89c4ba22748

📥 Commits

Reviewing files that changed from the base of the PR and between 46d00c8 and 84a5030.

📒 Files selected for processing (2)
  • tests/src/Kernel/FileFieldPathsProcessFileLegacyTest.php
  • tests/src/Kernel/MigrateMediaFileTest.php

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The pull request adds kernel regression coverage for migrated media files and unregistered temporary stream-wrapper schemes. Tests verify successful migration, file processing, destination creation, and avoidance of fatal errors.

Changes

Media file processing tests

Layer / File(s) Summary
Migration processing coverage
tests/src/Kernel/MigrateMediaFileTest.php
Configures document media processing, runs an embedded-data migration, and verifies the processed file at public://migrated/example.txt.
Unregistered scheme regressions
tests/src/Kernel/FileFieldPathsProcessFileLegacyTest.php, tests/src/Kernel/MigrateMediaFileTest.php
Verifies that an unregistered bogus:// temporary scheme does not cause a fatal error and that processing creates the destination file.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 84a50

This change adds regression coverage for the migration path and unregistered temporary URI handling without changing production behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies regression test coverage for the migration path associated with issue #3432653 and the reported crash. It accurately summarizes the main change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/3432653-scheme-guard

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.37%. Comparing base (d23f47e) to head (84a5030).
⚠️ Report is 4 commits behind head on 8.x-1.x.

Additional details and impacted files
@@             Coverage Diff             @@
##           8.x-1.x      #26      +/-   ##
===========================================
- Coverage    83.39%   83.37%   -0.03%     
===========================================
  Files           20       20              
  Lines          783      782       -1     
===========================================
- Hits           653      652       -1     
  Misses         130      130              

☔ 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.

@Decipher
Decipher changed the base branch from 8.x-1.x to chore/renovate-automerge August 28, 2026 03:16
@Decipher
Decipher changed the base branch from chore/renovate-automerge to 8.x-1.x August 28, 2026 03:17
@Decipher Decipher closed this Aug 28, 2026
@Decipher Decipher reopened this Aug 28, 2026
@Decipher Decipher closed this Aug 28, 2026
@Decipher Decipher reopened this Aug 28, 2026
@Decipher
Decipher force-pushed the feature/3432653-scheme-guard branch from 02bc7cf to 84a5030 Compare August 28, 2026 06:02
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