lpil / lpil/youid

Warnings about truncated bit array segments when building for javascript target

Open
#16 1 comment 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Gleam
Stars
37
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```
warning: Truncated bit array segment
┌─ /home/liv/source/gleam/gleeps/gleeps_shared/build/packages/youid/src/youid/uuid.gleam:246:64

246 │ let assert <> =
│ ^^^^^^^^

This segment is a 62-bit long int, but on the JavaScript target numbers
have at most 52 bits. It would be truncated to its first 52 bits.

Hint: Did you mean to use the `bytes` segment option?

warning: Truncated bit array segment
┌─ /home/liv/source/gleam/gleeps/gleeps_shared/build/packages/youid/src/youid/uuid.gleam:280:26

280 │ let assert <> = crypto.hash(crypto.Sha1, data)
│ ^^^^^^^^^

This segment is a 128-bit long int, but on the JavaScript target numbers
have at most 52 bits. It would be truncated to its first 52 bits.

Hint: Did you mean to use the `bytes` segment option?

warning: Truncated bit array segment
┌─ /home/liv/source/gleam/gleeps/gleeps_shared/build/packages/youid/src/youid/uuid.gleam:299:30

299 │ let assert <> =
│ ^^^^^^^^

This segment is a 62-bit long int, but on the JavaScript target numbers
have at most 52 bits. It would be truncated to its first 52 bits.

Hint: Did you mean to use the `bytes` segment option?

warning: Truncated bit array segment
┌─ /home/liv/source/gleam/gleeps/gleeps_shared/build/packages/youid/src/youid/uuid.gleam:357:18

357 │ let assert <> = <>
│ ^^

This segment is a 60-bit long int, but on the JavaScript target numbers
have at most 52 bits. It would be truncated to its first 52 bits.

Hint: Did you mean to use the `bytes` segment option?
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing a JavaScript-target build and inspect the bit-array segments in src/youid/uuid.gleam at lines 246, 280, 299, and 357. Check how these segments behave on the JavaScript target; done means the build no longer emits the reported truncation warnings without breaking the UUID operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.