Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

relay: a float-spelled timestamp is rejected, which the capture accepts

Đang mở Phù hợp với người mới
#960 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust, typescript
Lĩnh vực
api, backend

Hướng nghiên cứu

Đọc crates/nostream-core/src/messages.rs:474-494 và so sánh cách phân tích created_at với nhánh kind. Kiểm tra src/schemas/base-schema.ts:23-27 để biết capture chấp nhận hành vi số nguyên nào. Chấp nhận timestamp nằm trong phạm vi có phần thập phân bằng không, đồng thời giữ các phần thập phân thực sự là không hợp lệ; xác nhận 1700000000.0 được chấp nhận và timestamp có phần thập phân bị từ chối.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug factory rewrite rust

A created_at written in float spelling — 1700000000.0, or any value a JSON encoder emits with a fractional part of zero — is rejected by the port and accepted by the capture.

Port: crates/nostream-core/src/messages.rs:474-486 matches Value::Number and requires as_i64(), which returns None for a float, then errors with Invalid timestamp. kind two fields later already handles this correctly (:491-494), rejecting only a float whose fract() != 0.0.

Capture: src/schemas/base-schema.ts:23-27 — z.number().int().min(0).refine(Number.isSafeInteger …). In JavaScript there is no float/int distinction after parsing: 1700000000.0 is the number 1700000000, Number.isInteger is true, and the value passes.

So the two disagree on an encoding nobody writes by hand but encoders emit routinely. A client that serialises with a floating-point formatter is rejected here and accepted there.

Fix direction: mirror the kind branch — accept a Value::Number whose f64 has a zero fractional part and lies in range. Keep rejecting a genuine fraction.

Measured on rewrite/main at 740ef69: pre-existing, outside #950–#952's diff, and not made more reachable by it.

Ngôn ngữ chính
TypeScript
Star
829
Fork
234
Merge trung bình
17 giờ 47 phút
Pull request đã merge (30 ngày)
91

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của cameri/nostream

Tất cả issue của cameri/nostream

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.