Skip to content

Validate attachment child MIME metadata shape#368

Merged
adamziel merged 1 commit into
trunkfrom
codex/upload-mime-type-shape
May 18, 2026
Merged

Validate attachment child MIME metadata shape#368
adamziel merged 1 commit into
trunkfrom
codex/upload-mime-type-shape

Conversation

@adamziel
Copy link
Copy Markdown
Contributor

What it does

Reports present-but-empty or non-string generated-size and backup-size mime-type metadata as plugin-wp-attachment-metadata-invalid-shape in the built-in WordPress upload validator.

Rationale

Malformed mime-type fields are metadata shape problems, not extension drift. Keeping them in the invalid-shape bucket avoids presenting bad metadata as a normal MIME mismatch repair.

Implementation

cow_merge_wordpress_attachment_upload_issues() now validates generated and backup mime-type values before comparing them to the file extension. Invalid values record the affected metadata field, role, value type, attachment file, child file, and upload path evidence.

The media validator fixture adds generated-size and backup-size attachments with empty child MIME metadata and asserts that the built-in validator records invalid-shape conflicts while the built-in MIME-drift count stays unchanged.

Testing instructions

git diff --check 'origin/trunk'...HEAD && git diff --check && git diff --cached --check
php -l scripts/cow/merge.php
php -l tests/cow/media_validator.php
php tests/cow/media_validator.php
php tests/cow/merge_smoke.php
php tests/cow/schema_review.php

Report empty or non-string generated-size and backup-size MIME metadata through the built-in WordPress upload validator instead of treating malformed values as MIME drift.
@adamziel adamziel merged commit 5b98cb2 into trunk May 18, 2026
1 check passed
@adamziel adamziel deleted the codex/upload-mime-type-shape branch May 18, 2026 19:15
adamziel added a commit that referenced this pull request May 18, 2026
## What it does

Adds focused media-validator coverage for generated-size and backup-size
`mime-type` metadata values that are present but not strings.

## Rationale

PR #368 taught the built-in WordPress upload validator to classify empty
or non-string child MIME metadata as
`plugin-wp-attachment-metadata-invalid-shape`. The fixture covered empty
strings; this adds explicit non-string evidence so the guard cannot
regress silently.

## Implementation

The fixture now creates one generated child image with numeric
`mime-type` metadata and one backup image with numeric `mime-type`
metadata. The assertions verify both records appear in the built-in
invalid-shape audit, while the built-in MIME-drift conflict count
remains unchanged.

## Testing instructions

```bash
git diff --check 'origin/trunk'...HEAD && git diff --check && git diff --cached --check
php -l tests/cow/media_validator.php
php tests/cow/media_validator.php
```

Co-authored-by: Codex <codex@openai.com>
@adamziel adamziel mentioned this pull request May 18, 2026
adamziel added a commit that referenced this pull request May 18, 2026
## Release `v0.1.44`

Version bump and release metadata update for `v0.1.44`.

**Changelog draft:**
* Validate attachment child MIME metadata shape
([#368](#368))
* Cover non-string attachment child MIME metadata
([#369](#369))
* Cover explicit parent page ID holds
([#370](#370))
* Refresh merge reliability evidence for v0.1.43
([#371](#371))

**Full changelog:**
v0.1.43...release/v0.1.44

## Next steps

1. **Review** the changes in this pull request.
2. **Push** any additional edits to this branch (`release/v0.1.44`).
3. **Merge** this pull request to publish `v0.1.44`.

Merging will automatically build ForkPress binaries, create a GitHub
release, and update the Homebrew formula.

Co-authored-by: Codex <codex@openai.com>
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