chore(runtime): split date.rs under the 2000-line CI cap#4925
Merged
Conversation
date.rs grew to 2008 lines (pushed over by the Temporal tail in #4923), tripping scripts/check_file_size.sh and failing the required lint gate on every open PR (the check runs against each PR's merge with current main). Extract the date-string parsing cluster - parse_date_string + its per-grammar helpers (parse_iso8601, parse_rfc_or_named, parse_tz_offset, normalize_millis, month_from_name, FULL_MONTHS) - into a new crates/perry-runtime/src/date/parse.rs submodule (Rust 2018 keeps date.rs alongside date/parse.rs, no rename). date.rs declares `mod parse;` and re-exports the single entry point via `use parse::parse_date_string;`; the per-grammar helpers stay private to the submodule. Shared time math (make_utc_ms, time_clip, timestamp_to_local_components) stays in the parent and is reached via super:: (a child module can see its ancestor's private items, so no visibility was widened beyond parse_date_string). Pure code movement, no behavior change. date.rs 2008 -> 1675 lines, date/parse.rs 347. fmt clean; all date tests pass except the pre-existing test_full_year_setters_revive_invalid_date_only, which is timezone-dependent (asserts local hours == 0 after a local setFullYear) and fails identically on clean main on a non-UTC host - CI runs UTC and passes it.
proggeramlug
pushed a commit
that referenced
this pull request
Jun 10, 2026
…ine CI cap #4930 (regex d flag) pushed regex.rs to 2260 lines, tripping the lint job's file-size gate on every PR merged after it. Extract the match- result array decoration group (index/input/groups/indices builders for both the regex-crate fast path and the fancy_regex fallback, plus the char/byte index converters) into regex/exec_array.rs — same recipe as the date.rs split (#4925). No behavior change; d-flag output verified byte-identical with Node post-split.
proggeramlug
added a commit
that referenced
this pull request
Jun 10, 2026
…nstructable via new (#4904) (#4936) * fix(http): make Agent/ClientRequest/IncomingMessage/ServerResponse constructable via new (#4904) Node exposes http.Agent, http.ClientRequest, http.IncomingMessage, and http.ServerResponse as constructable classes; under Perry, new-ing them threw 'TypeError: <X> is not a constructor' through every value-aliasing path (const { Agent } = require('http'), require('_http_agent').Agent, const CR = http.ClientRequest, new http.IncomingMessage(), ...). Mechanism (mirrors the existing OutgoingMessage route end-to-end): - runtime/native_module: export the four classes (plus the previously missing http.get / http.request twins of the https entries) as bound callable values with Node .length arities. - runtime/class_registry: extend the http construct arm so js_new_function_construct forwards (module, class, args) through JS_NATIVE_HTTP_DISPATCH; forward the real module name so https.Agent constructs with the https protocol default. - stdlib/dispatch: constructor arms — Agent -> js_http_agent_new, ClientRequest -> new js_http_client_request_standalone_new, IncomingMessage/ServerResponse -> new standalone factories in perry-ext-http-server; plus get/request value-call arms. - HIR: member-form new http.{ClientRequest,IncomingMessage, ServerResponse}() joins the OutgoingMessage NewDynamic route; bare-ident forms (destructured imports) added for all four classes; the three handle-backed classes are skip-listed from typed native-instance registration so instances dispatch dynamically. - cjs_wrap: require('_http_agent') (and the other _http_* internal modules) binds its hoisted import to the public 'http' surface. Instance surface (perry-ext-http-server): - IncomingMessage: standalone constructor storing the socket argument; socket/connection get/set aliasing (Node's connection accessor writes this.socket); _addHeaderLine with Node's matchKnownFields semantics (first-wins singles, ', '/'; ' joins, set-cookie array). - ServerResponse: standalone constructor (req.method captured; HEAD suppresses the body), assignSocket/detachSocket with ERR_HTTP_SOCKET_ASSIGNED on double assignment, write(chunk, cb) callback queueing, end() flushing head+body through the assigned socket's JS write method (one corked write + the zero-length finish chunk), write/end callbacks invoked in order. - Agent: dynamic property reads (maxSockets, freeSockets, protocol, ...) and writes (tunables + createConnection/createSocket monkeypatching) through handle dispatch in both perry-stdlib and perry-ext-http. Also fixes a latent SIGSEGV: json/stringify's is_closure_value probed CLOSURE_MAGIC at offset 12 of POINTER_TAG payloads without the handle- band guard (same #2154 bug class as the sibling probe in the file), so JSON.stringify of { agent, lookup: () => {} } dereferenced unmapped low memory. Route through addr_class::is_handle_band first. Node corpus (test/parallel, pinned v22): 7 of the 13 tests in #4904 now pass outright (client-defaults, agent-timeout-option, client-timeout-option-with-agent, incoming-message-connection-setter, incoming-message-destroy, outgoing-message-write-callback, server-response-standalone); the other 6 construct and run to their assertions, failing on deeper Agent pool emulation (sockets/freeSockets per-key arrays, real createConnection sockets) and a pre-existing deepStrictEqual divergence, tracked separately. Closes #4904. Part of #2132. * chore: cargo fmt — regex.rs long call from #4930 landed unformatted * chore(runtime): split regex.rs exec-array decoration under the 2000-line CI cap #4930 (regex d flag) pushed regex.rs to 2260 lines, tripping the lint job's file-size gate on every PR merged after it. Extract the match- result array decoration group (index/input/groups/indices builders for both the regex-crate fast path and the fancy_regex fallback, plus the char/byte index converters) into regex/exec_array.rs — same recipe as the date.rs split (#4925). No behavior change; d-flag output verified byte-identical with Node post-split. --------- Co-authored-by: Ralph Küpper <ralph@skelpo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Brings
crates/perry-runtime/src/date.rsback under the 2000-line CI cap by extracting the date-string parsing code into a sibling submodule.Why
date.rshad grown to 2008 lines (pushed over by the Temporal tail in #4923), trippingscripts/check_file_size.shand failing the requiredlintgate on every open PR — the file-size check runs against each PR's merge with currentmain, so this blocks the whole queue, not just one PR.How
Extracted the date-string parsing cluster —
parse_date_string+ its per-grammar helpers (parse_iso8601,parse_rfc_or_named,parse_tz_offset,normalize_millis,month_from_name,FULL_MONTHS) — into a newcrates/perry-runtime/src/date/parse.rs. Rust 2018 keepsdate.rsalongsidedate/parse.rs(no rename tomod.rs).date.rsdeclaresmod parse;and re-exports the single entry point withuse parse::parse_date_string;.make_utc_ms,time_clip,timestamp_to_local_components) stays in the parent and is reached viasuper::— a child module can see its ancestor's private items, so no visibility was widened beyondparse_date_string.Pure code movement, no behavior change.
date.rs2008 → 1675 lines;date/parse.rs347.Testing
cargo fmt -p perry-runtime --checkclean.date::tests pass excepttest_full_year_setters_revive_invalid_date_only, which is pre-existing and timezone-dependent (it asserts local hours == 0 after a localsetFullYear). It fails identically on cleanmainon a non-UTC host (verified locally on UTC+1); CI runs in UTC and passes it. Not introduced by this PR.Note
Unblocks the
lintgate for all open PRs (e.g. #4897). Tiny follow-update/split candidates remain (formatting helpers, the setter rebuild logic) if we want more headroom later.