Skip to content

node:net: implement BlockList and SocketAddress classes #2508

Closed

Description

@andrewtdiz

Summary

node:net has gained substantial Socket/Server and IP-classification coverage, but the data-structure classes net.BlockList and net.SocketAddress are still absent from the manifest/runtime surface.

These APIs are deterministic and do not require live network I/O, so they are good candidates for focused Node parity coverage separate from the socket lifecycle trackers.

Evidence

  • docs/runtime-parity-gaps.md still lists the complete BlockList surface as missing: new net.BlockList(), addAddress, addRange, addSubnet, check, fromJSON, toJSON, rules, and BlockList.isBlockList(value).
  • The same gap table lists the SocketAddress surface as missing: new net.SocketAddress([options]), address, family, flowlabel, port, and SocketAddress.parse(input).
  • test-files/test_parity_net.ts has generated probes for both classes, including constructing a BlockList, adding address/range/subnet rules, checking addresses, serializing rules, calling BlockList.isBlockList, constructing SocketAddress, reading its fields, and calling SocketAddress.parse.
  • Source search across crates/perry-api-manifest, crates/perry-codegen, crates/perry-stdlib/src/net, and crates/perry-runtime finds no BlockList, SocketAddress, addAddress, addRange, addSubnet, isBlockList, or SocketAddress.parse implementation entries outside the generated parity probe.
  • Existing net manifest/native-table rows cover Socket/Server operations, IP classification helpers, and Happy-Eyeballs defaults, but not these two classes.

I did not run a fresh local parity command because this checkout does not have a target/release/perry binary; this issue is based on committed parity metadata and source inspection.

Non-duplicates checked

Expected behavior

Implement Node-compatible deterministic behavior for:

  • new net.BlockList() with rule storage, addAddress, addRange, addSubnet, check, toJSON, fromJSON, rules, and static BlockList.isBlockList.
  • new net.SocketAddress(options) with validated address, family, flowlabel, and port fields.
  • SocketAddress.parse(input) for supported IPv4/IPv6 address string forms.

Focused parity tests can avoid live sockets and should be stable in CI.

Activity

  1. andrewtdiz commented on May 31, 2026

    @andrewtdiz
    ContributorAuthor

    Fresh local runtime evidence on current baseline confirms this remains active:

    aed3a2b1b985 chore: complete stream tasklist reconciliation (#3790)
    
    perl -e 'alarm shift; exec @ARGV' 120 ./run_parity_tests.sh --filter test_parity_net

    Report:

    /private/tmp/perry-node-compat-main/test-parity/reports/parity_report_20260531_141005.json
    

    Node exposes both deterministic classes:

    class net.BlockList typeof: function
    new net.BlockList typeof: object
    blockList.addAddress: ok
    blockList.addRange: ok
    blockList.addSubnet: ok
    blockList.check('127.0.0.1'): true
    blockList.check('8.8.8.8'): false
    blockList.toJSON isArray: true
    blockList.rules isArray: true
    BlockList.isBlockList(bl): true
    BlockList.isBlockList({}): false
    class net.SocketAddress typeof: function
    new net.SocketAddress typeof: object
    socketAddress.address: 127.0.0.1
    socketAddress.family: ipv4
    socketAddress.flowlabel typeof: number
    socketAddress.port: 0
    SocketAddress.parse typeof: object
    

    Perry still reports missing/nonfunctional class surface before the run later reaches the separate #3850 crash:

    class net.BlockList typeof: undefined
    new net.BlockList typeof: object
    BlockList error: addAddress is not a function
    class net.SocketAddress typeof: undefined
    new net.SocketAddress typeof: object
    socketAddress.address: undefined
    socketAddress.family: undefined
    socketAddress.flowlabel typeof: undefined
    socketAddress.port: undefined
    SocketAddress.parse typeof: undefined
    
  2. andrewtdiz commented on Jun 2, 2026

    @andrewtdiz
    ContributorAuthor

    I'm taking this as part of a focused node:net compatibility PR cut with #2546 and #2548.

    Intended PR cut:

    I'll keep this scoped to the existing node:net manifest/codegen/runtime/test paths and avoid unrelated stream, HTTP, TLS, or broad transport rewrites.

  3. andrewtdiz commented on Jun 2, 2026

    @andrewtdiz
    ContributorAuthor

    Implemented in draft PR #4057: #4057

  4. andrewtdiz commented on Jun 2, 2026

    @andrewtdiz
    ContributorAuthor

    Opened draft PR #4069 for this grouped node:net work: #4069

    The PR implements BlockList / SocketAddress handles, constructors, validation, JSON/rules helpers, and a targeted Node 25 parity fixture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions