Skip to content

(10) feat(match-action): MatchKey trait + derive + bolero generators#1574

Merged
daniel-noland merged 0 commit into
pr/daniel-noland/dpdk-test-ealfrom
pr/daniel-noland/match-action
Jun 5, 2026
Merged

(10) feat(match-action): MatchKey trait + derive + bolero generators#1574
daniel-noland merged 0 commit into
pr/daniel-noland/dpdk-test-ealfrom
pr/daniel-noland/match-action

Conversation

@daniel-noland

@daniel-noland daniel-noland commented May 31, 2026

Copy link
Copy Markdown
Collaborator

Stack (10). Base: pr/daniel-noland/fixed-size-lookup.

The match-action core: the trait + derive macro that everything keys off, plus
its property-test generators.

  • feat(match-action): MatchKey trait + #[derive(MatchKey)] proc-macro.
  • feat(match-action): bolero FieldHit / FieldMiss generators.

Review focus: derive semantics and generator coverage, in isolation from ACL.

Review stack (merge bottom -> top):

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the match-action core crate and derive macro, providing typed field/rule specs, erased predicates, MatchKey derivation, and bolero-based field generators for future ACL and cascade layers.

Changes:

  • Introduces dataplane-match-action with MatchKey, field specs, predicates, rule specs, and generator support.
  • Adds dataplane-match-action-derive proc macro for deriving key layout and companion rule structs.
  • Adds workspace registration, lockfile entries, and derive/generator roundtrip tests.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Cargo.toml Registers match-action crates and package metadata.
Cargo.lock Adds lock entries for the new crates.
match-action/Cargo.toml Defines crate dependencies and feature flags.
match-action/src/lib.rs Exposes public match-action API types and traits.
match-action/src/field.rs Re-exports FixedSize.
match-action/src/rule.rs Adds rule field specs and universal checks.
match-action/src/predicate.rs Adds erased predicate matching and conversions.
match-action/src/generator.rs Adds bolero hit/miss generators for field predicates.
match-action/tests/derive_roundtrip.rs Tests derive layout, packing, rules, and generics.
match-action-derive/Cargo.toml Defines proc-macro crate dependencies/features.
match-action-derive/src/lib.rs Implements #[derive(MatchKey)].

Comment thread match-action/src/generator.rs
Comment thread match-action/src/generator.rs
Comment on lines +293 to +296
let lo = be_to_u32(min);
let hi = be_to_u32(max);
let v = (lo..=hi).generate(d)?;
Some(u32_to_be(v, min.len()))

@mvachhar mvachhar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the use of the macro, I hate the definition since it is really hard to understand, but that is the nature of these macros I suppose.

Copilot has some things that should be addressed.

Also, your FiveTuple doc example should be ThreeTuple or expanded to an actual FiveTuple.

I also feel like the macro testing is light, but that might be ok if we are mainly just using a single data type for most of dataplane. We can fix bugs later as we add more data types, assuming bugs crop up.

Comment thread match-action/src/lib.rs Outdated
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/fixed-size-lookup branch from 4bc3201 to 9509b0a Compare June 3, 2026 19:50
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/match-action branch from c071ee9 to 7d5e7ad Compare June 3, 2026 19:50
Base automatically changed from pr/daniel-noland/fixed-size-lookup to pr/daniel-noland/dpdk-test-eal June 5, 2026 06:13
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/dpdk-test-eal branch from bdba8a6 to 9808e5a Compare June 5, 2026 06:15
@daniel-noland daniel-noland merged commit 7d5e7ad into pr/daniel-noland/dpdk-test-eal Jun 5, 2026
32 of 50 checks passed
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/dpdk-test-eal branch from 9808e5a to 7d5e7ad Compare June 5, 2026 06:21
@daniel-noland daniel-noland deleted the pr/daniel-noland/match-action branch June 5, 2026 06:21
@daniel-noland daniel-noland restored the pr/daniel-noland/match-action branch June 5, 2026 06:27
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.

3 participants