matrix-org / matrix-org/rust-opa-wasm

The `units.parse` builtin should not round to the value to the nearest integer

Open
#43 0 comments 0 reactions 0 assignees View on GitHub
builtins
Dominant language
Rust
Stars
80
Forks
20
PR merge metrics
No merged PRs in 30d

Description

`units.parse("1.0005k")` outputs `1000` instead of `1000.5`. This is inconsistent with the Go implementation: https://play.openpolicyagent.org/p/TBQcYuuaQr

More context here: https://github.com/matrix-org/rust-opa-wasm/pull/30#pullrequestreview-1058803684

Contributor guide

Open the contributing guide

Research direction

Start by locating the Rust implementation of the `units.parse` builtin and compare its behavior with the linked Go implementation. Reproduce `units.parse("1.0005k")` and verify that the result retains the fractional value `1000.5` rather than rounding to `1000`.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.