Skip to content

Feat mimetype exclude negation tokens - #107

Merged
kjdev merged 3 commits into
masterfrom
feat/mimetype-exclude-negation-tokens
Aug 13, 2026
Merged

Feat mimetype exclude negation tokens#107
kjdev merged 3 commits into
masterfrom
feat/mimetype-exclude-negation-tokens

Conversation

@kjdev

@kjdev kjdev commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added support for negated MIME-type patterns in zstd output compression exclusions.
    • Added wildcard matching and last-match precedence for exclusion rules.
    • Configured rules can now override built-in exclusions, with built-in behavior retained when no rule matches.
  • Documentation

    • Documented pattern syntax, quoting requirements, rule precedence, and fallback behavior.
  • Tests

    • Added coverage for default exclusions, negation, wildcard matching, and rule-order overrides.

kjdev added 3 commits August 13, 2026 08:50
A token prefixed with `!` negates a match against the built-in MIME
exclusion list, allowing individual entries to be re-enabled for
compression. Within the same list, when multiple tokens match the
same MIME type, the last one listed wins, positive or negative
(gitignore-style precedence). The built-in list is only consulted as
a fallback when the user-configured list produces no definitive
match.
Cover the default built-in exclusion, overriding it with a negation
token, and the last-matching-token-wins precedence when a positive
and a negative token in the same list both match, in either order.
Explain the `!` token for re-enabling individual entries from the
built-in exclusion list, and the last-match-wins precedence rule
(gitignore-style: later tokens in the same list override earlier
ones, whether positive or negative).
@coderabbitai

coderabbitai Bot commented Aug 13, 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: ba5d7ae2-5a28-405f-8409-9dac854bf031

📥 Commits

Reviewing files that changed from the base of the PR and between 4b430df and b2b4ce6.

📒 Files selected for processing (6)
  • README.md
  • tests/ob_exclude_006.phpt
  • tests/ob_exclude_007.phpt
  • tests/ob_exclude_008.phpt
  • tests/ob_exclude_009.phpt
  • zstd.c

📝 Walkthrough

Walkthrough

The PR adds negated MIME-type patterns to zstd output compression exclusions. Matching supports wildcards and last-match precedence. Configured exclusions are evaluated before built-in exclusions. Tests and documentation cover the new behavior.

Changes

MIME exclusion behavior

Layer / File(s) Summary
Matcher and output-handler integration
zstd.c
The shared MIME matcher supports exact matches, wildcard prefixes, negated tokens, and last-match precedence. Configured exclusions are checked before built-in exclusions.
Behavior validation and documentation
tests/ob_exclude_00*.phpt, README.md
PHPT tests cover built-in exclusions, negated patterns, wildcard precedence, and conflicting token order. The README documents the matching rules and quoting requirements.

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

Mergeability Score: ⚪ Minimal · up to b2b4c

This localized MIME-type exclusion change includes documentation and tests, and no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant OutputHandler
  participant MimeExclusionMatcher
  participant ConfiguredExclusions
  participant BuiltInExclusions
  OutputHandler->>MimeExclusionMatcher: Check response MIME type
  MimeExclusionMatcher->>ConfiguredExclusions: Evaluate configured tokens
  ConfiguredExclusions-->>MimeExclusionMatcher: Return last matching result
  alt No definitive configured match
    MimeExclusionMatcher->>BuiltInExclusions: Check built-in exclusions
    BuiltInExclusions-->>MimeExclusionMatcher: Return built-in result
  end
  MimeExclusionMatcher-->>OutputHandler: Return compression exclusion result
Loading

Possibly related PRs

🚥 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 describes the main change: support for negation tokens in MIME-type exclusion patterns.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 feat/mimetype-exclude-negation-tokens

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.

@kjdev
kjdev merged commit b2b4ce6 into master Aug 13, 2026
242 of 245 checks passed
@kjdev
kjdev deleted the feat/mimetype-exclude-negation-tokens branch August 13, 2026 01:30
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