Repository navigation
Create flagd-evaluator WebAssembly library for JSON Logic evaluation - #1
Merged
Merged
Conversation
25 tasks
…tom operators Co-authored-by: aepfli <9987394+aepfli@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create complete Rust WebAssembly library flagd-evaluator
Create flagd-evaluator WebAssembly library for JSON Logic evaluation
Dec 1, 2025
Contributor
|
@copilot Can we reduce the wasm module size, and I |
aepfli
approved these changes
Dec 1, 2025
Co-authored-by: aepfli <9987394+aepfli@users.noreply.github.com>
Co-authored-by: aepfli <9987394+aepfli@users.noreply.github.com>
Contributor
Author
The CI build failures are now fixed (c1cd6dd) - the issue was using Regarding WASM size reduction:
Options to reduce further:
The release workflow now properly uses wasm-opt with |
Copilot stopped work on behalf of
aepfli due to an error
December 1, 2025 21:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WASM Size
The WASM module is ~1.4MB unoptimized and ~1.3MB after wasm-opt optimization. The size is due to the full
datalogic-rsJSON Logic implementation which includes:regexcrate for pattern matchingchronocrate for date/time operationsTo reduce size further, options include:
Original prompt
Project Creation Prompt for flagd-evaluator
Create a complete Rust WebAssembly library called flagd-evaluator that provides JSON Logic evaluation with custom operators, specifically designed to work with Chicory (pure Java WebAssembly runtime).
Project Structure
Core Requirements
1. Cargo.toml Configuration
2. Main Library Implementation (src/lib.rs)
Requirements:
evaluate_logicalloc,deallocfor memory managementFunction Signature:
Response Format (Always JSON):
3. Custom Operator Implementation (src/operators/custom.rs)
Implement one custom operator called
"fractional"that performs fractional evaluation (consistent hashing for A/B testing):Use murmurhash3 or a simple hash function for consistent distribution.
4. Memory Management (src/memory.rs)
Implement:
alloc(len: u32) -> *mut u8- Allocate memory from WASM linear memorydealloc(ptr: *mut u8, len: u32)- Free allocated memory5. Error Handling (src/error.rs)
Create a proper error type that serializes to JSON:
6. README.md
Must include:
7. GitHub Actions CI/CD (.github/workflows/ci.yml)
CI Pipeline:
cargo teston ubuntu-latestcargo clippy -- -D warningscargo fmt -- --checkcargo build --target wasm32-unknown-unknown --releaseflagd_evaluator.wasm8. GitHub Actions Release (.github/workflows/release.yml)
Release Pipeline:
flagd_evaluator.wasmas release asset9. Integration Tests (tests/integration_tests.rs)
Include tests for:
10. Java Example (examples/java/FlagdEvaluatorExample.java)
Provide...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.