Skip to content

[codex] Cover media MIME drift in merge validators#214

Merged
adamziel merged 1 commit into
trunkfrom
codex/upload-mime-validator
May 16, 2026
Merged

[codex] Cover media MIME drift in merge validators#214
adamziel merged 1 commit into
trunkfrom
codex/upload-mime-validator

Conversation

@adamziel
Copy link
Copy Markdown
Contributor

What it does

Adds focused media-validator coverage for WordPress attachment post_mime_type drift. A staged .jpg upload declared as application/pdf now produces a plugin-scoped plugin-wp-media-mime-drift audit conflict.

Rationale

Uploads are a DB-plus-files semantic object. The existing validator checked attachment metadata, upload paths, generated sizes, file ownership, and filesize drift, but did not cover the attachment row's MIME metadata. A merge that leaves wp_posts.post_mime_type inconsistent with the uploaded file should be review-visible instead of silently accepted by the validator.

Implementation

tests/cow/media_validator.php now:

  • includes post_mime_type in the attachment fixture schema,
  • allows attachment fixtures to declare a MIME type,
  • checks known image extensions (jpg, jpeg, png, gif, webp) against post_mime_type,
  • records plugin-wp-media-mime-drift with declared and expected MIME evidence.

docs/merge-reliability.md now lists this as covered upload validator evidence.

Testing instructions

  • php -l tests/cow/media_validator.php
  • make test-cow-media-validator
  • make test-cow-semantic-fast
  • git diff --check origin/trunk...HEAD

@adamziel adamziel merged commit fc74fed into trunk May 16, 2026
6 checks passed
@adamziel adamziel deleted the codex/upload-mime-validator branch May 16, 2026 20:10
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.

2 participants