Skip to content

chore: release v0.2.0#111

Merged
mergify[bot] merged 1 commit into
mainfrom
release-plz-2026-03-01T07-42-19Z
Mar 1, 2026
Merged

chore: release v0.2.0#111
mergify[bot] merged 1 commit into
mainfrom
release-plz-2026-03-01T07-42-19Z

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Mar 1, 2026

🤖 New release

  • libmagic-rs: 0.1.1 -> 0.2.0 (⚠ API breaking changes)

libmagic-rs breaking changes

--- failure enum_unit_variant_changed_kind: An enum unit variant changed kind ---

Description:
A public enum's exhaustive unit variant has changed to a different kind of enum variant, breaking possible instantiations and patterns.
        ref: https://doc.rust-lang.org/reference/items/enumerations.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/enum_unit_variant_changed_kind.ron

Failed in:
  variant TypeKind::Byte in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:84
  variant TypeKind::Byte in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:84
  variant TypeKind::Byte in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:84

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/enum_variant_added.ron

Failed in:
  variant Operator:LessThan in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:144
  variant Operator:GreaterThan in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:155
  variant Operator:LessEqual in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:166
  variant Operator:GreaterEqual in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:177
  variant Operator:LessThan in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:144
  variant Operator:GreaterThan in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:155
  variant Operator:LessEqual in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:166
  variant Operator:GreaterEqual in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:177
  variant Operator:LessThan in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:144
  variant Operator:GreaterThan in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:155
  variant Operator:LessEqual in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:166
  variant Operator:GreaterEqual in /tmp/.tmpchbzmC/libmagic-rs/src/parser/ast.rs:177

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/function_parameter_count_changed.ron

Failed in:
  libmagic_rs::evaluator::types::read_byte now takes 3 parameters instead of 2, in /tmp/.tmpchbzmC/libmagic-rs/src/evaluator/types.rs:79
Changelog

[0.2.0] - 2026-03-01

Features

  • parser: Implement comparison operators (#104)

Miscellaneous Tasks

  • Mergify: Add outdated PR protection (#75)
  • Add Mergify merge queue and simplify CI (#78)
  • Mergify merge queue, dependabot integration, and CI simplification (#79)
  • release: Add regex for version bumping based on commit types


This PR was generated with release-plz.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 1, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 1, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\\(.+\\))?!?:

🟢 CI must pass

Wonderful, this rule succeeded.

All CI checks must pass. This protection prevents manual merges that bypass the merge queue.

  • check-success = coverage
  • check-success = quality
  • check-success = test
  • check-success = test-cross-platform (macos-latest, macOS)
  • check-success = test-cross-platform (ubuntu-22.04, Linux)
  • check-success = test-cross-platform (ubuntu-latest, Linux)
  • check-success = test-cross-platform (windows-latest, Windows)

🟢 Do not merge outdated PRs

Wonderful, this rule succeeded.

Make sure PRs are within 10 commits of the base branch before merging

  • #commits-behind <= 10

@dosubot dosubot Bot added parser Magic file parsing components and grammar rust Rust language features and idioms labels Mar 1, 2026
@dosubot
Copy link
Copy Markdown
Contributor

dosubot Bot commented Mar 1, 2026

Documentation Updates

6 document(s) were updated by changes in this PR:

api-reference
View Changes
@@ -223,7 +223,7 @@
 
 | Variant | Description |
 |---------|-------------|
-| `Byte { signed }` | Single byte with explicit signedness |
+| `Byte { signed }` | Single byte with explicit signedness (struct variant since v0.2.0; previously unit variant) |
 | `Short { endian, signed }` | 16-bit integer |
 | `Long { endian, signed }` | 32-bit integer |
 | `String { max_length }` | String data |
@@ -240,10 +240,10 @@
 |---------|-------------|
 | `Equal` | Equality comparison (`=`) |
 | `NotEqual` | Inequality comparison (`!=`) |
-| `LessThan` | Less than comparison (`<`) |
-| `GreaterThan` | Greater than comparison (`>`) |
-| `LessEqual` | Less than or equal comparison (`<=`) |
-| `GreaterEqual` | Greater than or equal comparison (`>=`) |
+| `LessThan` | Less than comparison (`<`) (added in v0.2.0) |
+| `GreaterThan` | Greater than comparison (`>`) (added in v0.2.0) |
+| `LessEqual` | Less than or equal comparison (`<=`) (added in v0.2.0) |
+| `GreaterEqual` | Greater than or equal comparison (`>=`) (added in v0.2.0) |
 | `BitwiseAnd` | Bitwise AND |
 | `BitwiseAndMask(u64)` | Bitwise AND with mask |
 
@@ -477,6 +477,12 @@
 - **Minimum Rust Version**: 1.85
 - **Edition**: 2024
 - **License**: Apache-2.0
+- **Current Version**: 0.2.0
+
+### Breaking Changes in v0.2.0
+
+- `TypeKind::Byte` changed from a unit variant to a struct variant `Byte { signed }` to support explicit signedness
+- Added comparison operators: `LessThan`, `GreaterThan`, `LessEqual`, `GreaterEqual` to the `Operator` enum (breaking change due to exhaustive enum)
 
 For complete API documentation with examples, run:
 
API_REFERENCE
View Changes
@@ -298,11 +298,13 @@
 
 | Variant | Description |
 |---------|-------------|
-| `Byte { signed }` | Single byte with explicit signedness |
+| `Byte { signed }` | Single byte with explicit signedness (changed in v0.2.0) |
 | `Short { endian, signed }` | 16-bit integer |
 | `Long { endian, signed }` | 32-bit integer |
 | `String { max_length }` | String data |
 
+**Version Note:** In v0.2.0, the `Byte` variant changed from a unit variant to a struct variant with a `signed` field.
+
 #### Operator
 
 Comparison operators.
@@ -315,12 +317,14 @@
 |---------|-------------|
 | `Equal` | Equality comparison (`=` or `==`) |
 | `NotEqual` | Inequality comparison (`!=` or `<>`) |
-| `LessThan` | Less than comparison (`<`) |
-| `GreaterThan` | Greater than comparison (`>`) |
-| `LessEqual` | Less than or equal comparison (`<=`) |
-| `GreaterEqual` | Greater than or equal comparison (`>=`) |
+| `LessThan` | Less than comparison (`<`) (added in v0.2.0) |
+| `GreaterThan` | Greater than comparison (`>`) (added in v0.2.0) |
+| `LessEqual` | Less than or equal comparison (`<=`) (added in v0.2.0) |
+| `GreaterEqual` | Greater than or equal comparison (`>=`) (added in v0.2.0) |
 | `BitwiseAnd` | Bitwise AND (`&`) |
 | `BitwiseAndMask(u64)` | Bitwise AND with mask value |
+
+**Version Note:** The comparison operators `LessThan`, `GreaterThan`, `LessEqual`, and `GreaterEqual` were added in v0.2.0.
 
 #### Value
 
ast-structures
View Changes
@@ -164,6 +164,8 @@
 
 The `TypeKind` enum specifies how to interpret bytes at the given offset:
 
+> **Breaking Change in v0.2.0:** The `Byte` variant changed from a unit variant (`Byte`) to a struct variant (`Byte { signed: bool }`). Code that pattern-matches exhaustively on `TypeKind` requires updates.
+
 ### Numeric Types
 
 ```rust
@@ -235,6 +237,8 @@
     BitwiseAndMask(u64), // & (bitwise AND with mask value)
 }
 ```
+
+> **Added in v0.2.0:** The comparison operators `LessThan`, `GreaterThan`, `LessEqual`, and `GreaterEqual` were added. This is a breaking change for exhaustive matches on `Operator`.
 
 **Usage Examples:**
 
evaluator
View Changes
@@ -90,7 +90,7 @@
 
 Interprets bytes according to type specifications:
 
-- **Byte**: Single byte values
+- **Byte**: Single byte values (signed or unsigned)
 - **Short**: 16-bit integers with endianness
 - **Long**: 32-bit integers with endianness
 - **String**: Byte sequences with length limits
@@ -104,16 +104,18 @@
 ) -> Result<Value, TypeReadError>
 ```
 
+The `read_byte` function signature changed in v0.2.0 to accept three parameters (`buffer`, `offset`, and `signed`) instead of two, allowing explicit control over signed vs unsigned byte interpretation.
+
 ### Operator Application (`evaluator/operators.rs`)
 
 Applies comparison operations:
 
 - **Equal** (`=`, `==`): Exact value matching
 - **NotEqual** (`!=`, `<>`): Non-matching values
-- **LessThan** (`<`): Less-than comparison (numeric or lexicographic)
-- **GreaterThan** (`>`): Greater-than comparison (numeric or lexicographic)
-- **LessEqual** (`<=`): Less-than-or-equal comparison (numeric or lexicographic)
-- **GreaterEqual** (`>=`): Greater-than-or-equal comparison (numeric or lexicographic)
+- **LessThan** (`<`): Less-than comparison (numeric or lexicographic) *(added in v0.2.0)*
+- **GreaterThan** (`>`): Greater-than comparison (numeric or lexicographic) *(added in v0.2.0)*
+- **LessEqual** (`<=`): Less-than-or-equal comparison (numeric or lexicographic) *(added in v0.2.0)*
+- **GreaterEqual** (`>=`): Greater-than-or-equal comparison (numeric or lexicographic) *(added in v0.2.0)*
 - **BitwiseAnd** (`&`): Pattern matching for flags
 - **BitwiseAndMask**: AND with mask then compare
 
@@ -125,6 +127,34 @@
     left: &Value,
     right: &Value,
 ) -> bool
+```
+
+**Example with comparison operators:**
+
+```rust
+use libmagic_rs::parser::ast::{Operator, Value};
+use libmagic_rs::evaluator::operators::apply_operator;
+
+// Less-than comparison (v0.2.0+)
+assert!(apply_operator(
+    &Operator::LessThan,
+    &Value::Uint(5),
+    &Value::Uint(10)
+));
+
+// Greater-than-or-equal comparison (v0.2.0+)
+assert!(apply_operator(
+    &Operator::GreaterEqual,
+    &Value::Uint(10),
+    &Value::Uint(10)
+));
+
+// Cross-type integer comparison (v0.2.0+)
+assert!(apply_operator(
+    &Operator::LessThan,
+    &Value::Int(-1),
+    &Value::Uint(0)
+));
 ```
 
 ## Evaluation Algorithm
@@ -290,6 +320,26 @@
 for m in matches {
     println!("Match at offset {}: {}", m.offset, m.message);
 }
+```
+
+**Example with comparison operators (v0.2.0+):**
+
+```rust
+use libmagic_rs::{evaluate_rules, EvaluationConfig};
+use libmagic_rs::parser::parse_text_magic_file;
+
+// Parse magic rule with comparison operator
+let magic_content = r#"
+0 leshort <100 Small value detected
+0 leshort >=1000 Large value detected
+"#;
+let rules = parse_text_magic_file(magic_content)?;
+
+let buffer = vec![0x0A, 0x00]; // Little-endian 10
+let matches = evaluate_rules(&rules, &buffer)?;
+
+// Matches first rule (<100)
+assert_eq!(matches[0].message, "Small value detected");
 ```
 
 ## Implementation Status
migration
View Changes
@@ -185,6 +185,106 @@
 - **GNU file output**: Text output format compatibility
 - **Common use cases**: Drop-in replacement for most applications
 
+## Migrating from v0.1.x to v0.2.0
+
+Version 0.2.0 introduces breaking changes to support comparison operators and improve type handling. Update your code as follows:
+
+### TypeKind::Byte Variant Change
+
+The `Byte` variant changed from a unit variant to a struct variant with a `signed` field.
+
+**Before (v0.1.x):**
+
+```rust,ignore
+use libmagic_rs::parser::ast::TypeKind;
+
+match type_kind {
+    TypeKind::Byte => {
+        // Handle byte type
+    }
+    _ => {}
+}
+
+// Constructing
+let byte_type = TypeKind::Byte;
+```
+
+**After (v0.2.0):**
+
+```rust,ignore
+use libmagic_rs::parser::ast::TypeKind;
+
+match type_kind {
+    TypeKind::Byte { signed } => {
+        // Handle byte type, check signedness if needed
+        if signed {
+            // Handle signed byte
+        } else {
+            // Handle unsigned byte
+        }
+    }
+    _ => {}
+}
+
+// Constructing
+let signed_byte = TypeKind::Byte { signed: true };
+let unsigned_byte = TypeKind::Byte { signed: false };
+```
+
+### New Operator Variants
+
+The `Operator` enum added four comparison operators. Exhaustive matches must handle these variants.
+
+**Before (v0.1.x):**
+
+```rust,ignore
+use libmagic_rs::parser::ast::Operator;
+
+match operator {
+    Operator::Equal => { /* ... */ }
+    Operator::NotEqual => { /* ... */ }
+    // Other existing variants
+}
+```
+
+**After (v0.2.0):**
+
+```rust,ignore
+use libmagic_rs::parser::ast::Operator;
+
+match operator {
+    Operator::Equal => { /* ... */ }
+    Operator::NotEqual => { /* ... */ }
+    Operator::LessThan => { /* ... */ }
+    Operator::GreaterThan => { /* ... */ }
+    Operator::LessEqual => { /* ... */ }
+    Operator::GreaterEqual => { /* ... */ }
+    // Other existing variants
+}
+```
+
+### read_byte Function Signature
+
+The `libmagic_rs::evaluator::types::read_byte` function signature changed from 2 to 3 parameters.
+
+**Before (v0.1.x):**
+
+```rust,ignore
+use libmagic_rs::evaluator::types::read_byte;
+
+let value = read_byte(buffer, offset)?;
+```
+
+**After (v0.2.0):**
+
+```rust,ignore
+use libmagic_rs::evaluator::types::read_byte;
+
+// The third parameter indicates signedness
+let signed_value = read_byte(buffer, offset, true)?;
+let unsigned_value = read_byte(buffer, offset, false)?;
+```
+
 ## Getting Help
 
 If you encounter migration issues:
parser
View Changes
@@ -70,7 +70,7 @@
 parse_operator("!=")   // Ok(("", Operator::NotEqual))
 parse_operator("<>")   // Ok(("", Operator::NotEqual))
 
-// Comparison operators
+// Comparison operators (v0.2.0+)
 parse_operator("<")    // Ok(("", Operator::LessThan))
 parse_operator(">")    // Ok(("", Operator::GreaterThan))
 parse_operator("<=")   // Ok(("", Operator::LessEqual))
@@ -87,6 +87,8 @@
 - ✅ Whitespace tolerance
 - ✅ Invalid operator rejection with clear errors
 - ✅ Eight comparison and bitwise operators supported
+
+**Note:** Comparison operators (`<`, `>`, `<=`, `>=`) were implemented in v0.2.0 via [#104](https://github.com/EvilBit-Labs/libmagic-rs/pull/104).
 
 ### Value Parsing (`parse_value`)
 

How did I do? Any feedback?  Join Discord

@github-actions github-actions Bot force-pushed the release-plz-2026-03-01T07-42-19Z branch from 43d1bd4 to 293c953 Compare March 1, 2026 08:00
@unclesp1d3r unclesp1d3r self-assigned this Mar 1, 2026
dosubot Bot added a commit that referenced this pull request Mar 1, 2026
@dosubot dosubot Bot mentioned this pull request Mar 1, 2026
dosubot Bot added a commit that referenced this pull request Mar 1, 2026
@unclesp1d3r unclesp1d3r added the lgtm Approved for the merge queue label Mar 1, 2026
@unclesp1d3r unclesp1d3r closed this Mar 1, 2026
@unclesp1d3r unclesp1d3r reopened this Mar 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mergify mergify Bot added the queued label Mar 1, 2026
mergify Bot added a commit that referenced this pull request Mar 1, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 1, 2026

Merge Queue Status

Rule: default


This pull request spent 4 minutes 58 seconds in the queue, including 4 minutes 32 seconds running CI.

Required conditions to merge
  • check-success = coverage
  • check-success = quality
  • check-success = test
  • check-success = test-cross-platform (macos-latest, macOS)
  • check-success = test-cross-platform (ubuntu-22.04, Linux)
  • check-success = test-cross-platform (ubuntu-latest, Linux)
  • check-success = test-cross-platform (windows-latest, Windows)
  • all of [🛡 Merge Protections rule CI must pass]:
    • check-success = coverage
    • check-success = quality
    • check-success = test
    • check-success = test-cross-platform (macos-latest, macOS)
    • check-success = test-cross-platform (ubuntu-22.04, Linux)
    • check-success = test-cross-platform (ubuntu-latest, Linux)
    • check-success = test-cross-platform (windows-latest, Windows)
  • all of [🛡 Merge Protections rule Do not merge outdated PRs]:
  • all of [🛡 Merge Protections rule Enforce conventional commit]:
  • any of [🛡 GitHub repository ruleset rule main]:
    • check-success = DCO
    • check-neutral = DCO
    • check-skipped = DCO
  • any of [🛡 GitHub repository ruleset rule main]:
    • check-neutral = Mergify Merge Protections
    • check-skipped = Mergify Merge Protections
    • check-success = Mergify Merge Protections

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Mar 1, 2026

🧪 CI Insights

Here's what we observed from your CI run for 293c953.

🟢 All jobs passed!

But CI Insights is watching 👀

@mergify mergify Bot merged commit a88e0ad into main Mar 1, 2026
29 checks passed
@mergify mergify Bot deleted the release-plz-2026-03-01T07-42-19Z branch March 1, 2026 20:12
@mergify mergify Bot removed the queued label Mar 1, 2026
dosubot Bot added a commit that referenced this pull request Mar 1, 2026
mergify Bot added a commit that referenced this pull request Mar 1, 2026
Update documentation for
#111

_Generated by [Dosu](https://dosu.dev)_

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dosubot[bot] <131922026+dosubot[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
unclesp1d3r added a commit that referenced this pull request Mar 1, 2026
## Summary

- Exempt release-plz PRs (`head ~= ^release-plz-`) from the "CI must
pass" merge protection
- Release-plz force-pushes when updating existing PRs, and
`GITHUB_TOKEN`-triggered pushes suppress workflow events, so CI never
runs on the new HEAD — causing the merge protection to hang indefinitely
(see PR #111)
- Release-plz PRs only bump versions and changelogs; the code was
already tested on main. CI still runs in the merge queue as a final
safety net.

## Test plan

- [ ] Verify PR #111 is no longer blocked by Mergify Merge Protections
after this lands
- [ ] Verify non-release-plz PRs still require CI to pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: UncleSp1d3r <unclesp1d3r@evilbitlabs.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Approved for the merge queue parser Magic file parsing components and grammar rust Rust language features and idioms size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant