wavefnd / wavefnd/Wave

Classify native network errors using the selected operating system

Open
#508 0 comments 0 reactions 0 assignees View on GitHub
bug cross-platform good first issue needs testing
Dominant language
Rust
Stars
53
Forks
16
Avg merge
4h 22m
Merged PRs (30d)
46

Description

## Reproduced problem

`std/net/error.wave::net_error_from_native` combines Linux, BSD/Darwin and Winsock error numbers in one unconditional table. Numbers overlap across OSes, so an unrelated error can be reported as retryable or as a refused connection.

On Linux, `EDEADLK` is 35 and `ENODATA` is 61. This program prints `deadlock=3 no_data=5`: `NET_ERROR_WOULD_BLOCK` and `NET_ERROR_REFUSED` respectively.

```wave
import("std::net::error")::{NetError, net_error_from_native};
fun main() -> i32 {
var deadlock: NetError = net_error_from_native(-35);
var no_data: NetError = net_error_from_native(-61);
println("deadlock={} no_data={}", deadlock.kind, no_data.kind);
return 0;
}
```

Build/run with the repository std installed in the test HOME. Compare the host constants with `python3 -c 'import errno; print(errno.EDEADLK, errno.ENODATA)'`. Genuine Linux EAGAIN (11) and ECONNREFUSED (111) must continue mapping correctly.

## Scope and acceptance

- [ ] Use target-gated mappings for Linux, macOS, FreeBSD and Windows rather than combining numeric aliases from different OSes.
- [ ] Preserve `native_code` exactly and return `NET_ERROR_OTHER` for codes without an applicable category.
- [ ] Add table-driven Wave regression checks for recognized codes, cross-OS collisions and unknown values.
- [ ] Keep the public result/error structures and existing category constants unchanged.
- [ ] Use existing target attributes and native constants; no libc FFI or new dependency is needed for this mapping.

This is a good first issue: the change is a small pure classification function, and tests need no live network connection. Verify each OS table against its own constants rather than inferring them from Linux.

Audited on canonical master `0c67f4cc0c3946cbf708c11ef79db927ec8f054e` (same source tree as #502 head). Executable reproductions used Fedora Linux amd64, Wave `0.2.1-pre-beta-dev`, LLVM 21.1.8.

Contributor guide

Open the contributing guide

Research direction

Start in std/net/error.wave at net_error_from_native, then inspect the existing target attributes and native constants for Linux, macOS, FreeBSD, and Windows. Run the supplied Linux reproduction and locate the existing Wave regression-test entry point for std/net/error; done means recognized codes map per target, collisions and unknown values return the expected categories, and native_code and public structures remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.