Skip to content

refactor: convert defaults.js to defaults.json in streams/node/join#12303

Closed
Planeshifter wants to merge 1 commit into
developfrom
philipp/drift-streams-node-2026-05-26
Closed

refactor: convert defaults.js to defaults.json in streams/node/join#12303
Planeshifter wants to merge 1 commit into
developfrom
philipp/drift-streams-node-2026-05-26

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • converts the default-options module in @stdlib/streams/node/join from a function-form lib/defaults.js to a flat lib/defaults.json file, matching the convention used by the majority of sibling packages under streams/node/*.

Namespace summary

Surveyed @stdlib/streams/node/* (16 non-autogenerated members). Features analyzed: file tree, package.json shape, README section structure, validation prologue, error-construction style, default-options module shape. Features with a clear majority (≥75%): file-tree skeleton (lib/main.js, lib/index.js, lib/validate.js, lib/factory.js, lib/object_mode.js, lib/defaults.json, docs/repl.txt, etc.), package.json top-level key set, error construction via @stdlib/string/format (13/13 packages with validate.js), isPlainObject first-check in validation prologues (13/13). Features without a clear majority (excluded): README h2 Notes section (10/16), CLI section (2/16).

@stdlib/streams/node/join

Converts lib/defaults.js (a function returning a static object literal) to lib/defaults.json, aligning with the convention used by 12 of 16 configurable streams/node/* packages. The removed function introduced no dynamism — all five defaults were primitives fixed at declaration time. lib/main.js is updated to require('./defaults.json') and initialize options via assign({}, DEFAULTS).

Validation

  • Structural extraction (file tree, package.json keys, README headings, test//benchmark//examples/ file names) across all 16 members.
  • Three-agent drift validation: semantic-review (does the deviation reflect a genuine difference?), cross-reference (do tests/examples/docs depend on the deviating shape?), structural-review (is the majority pattern actually applicable?). All three returned confirmed-drift for the join correction.
  • Deliberately excluded: stderr, stdin, stdout (singleton re-exports of process.* with no configurable options — legitimate absence of defaults.json, validate.js, factory.js); transform's per-module debug loggers (intentional design — four distinct debug namespaces, not a single shared logger); the README See Also section (auto-populated by the package generator); benchmark benchmark.throughput.js for empty (semantically empty stream — synthesis requires package-specific knowledge).

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Total diff: 3 files (+10/−48). No change to observable behavior, public API surface, or test expectations — the removed defaults() function returned { objectMode: false, encoding: null, allowHalfOpen: false, readableObjectMode: false, sep: '\n' } on every call, exactly the contents of the new lib/defaults.json.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was produced by a cross-package drift-detection routine running on Claude Code. The routine surveyed structural and semantic features across all 16 streams/node/* packages, identified the majority pattern per feature (≥75% threshold), and ran three independent validation agents per outlier before proposing a fix. The mechanical edit, commit, and PR body were authored by the agent under human direction; a maintainer should promote the draft only after independent review.


@stdlib-js/reviewers


Generated by Claude Code

Aligns `streams/node/join` with the sibling-package convention: 12/16
(75%) of `streams/node/*` packages with configurable options expose
defaults via a `lib/defaults.json` file and consume them with
`assign( {}, DEFAULTS )`. `join` was the lone outlier carrying an
equivalent `lib/defaults.js` function that returned a static object
literal — no dynamism, no semantic difference.

- Adds `lib/defaults.json` mirroring the literal returned by the
  removed `lib/defaults.js`.
- Removes `lib/defaults.js`.
- Updates `lib/main.js` to require the JSON file and use
  `@stdlib/object/assign` for a fresh copy, matching the pattern in
  `from-array`, `from-iterator`, `split`, and other siblings.

No change to observable behavior, public API, or test expectations.
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
streams/node/join $\color{green}652/652$
$\color{green}+100.00%$
$\color{green}63/63$
$\color{green}+100.00%$
$\color{green}9/9$
$\color{green}+100.00%$
$\color{green}652/652$
$\color{green}+100.00%$

The above coverage report was generated for the changes in this PR.

Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is not necessary. If anything, we should update the other packages to use a defaults.js file which exports a function return an object containing defaults.

@kgryte kgryte closed this May 27, 2026
@kgryte kgryte deleted the philipp/drift-streams-node-2026-05-26 branch May 27, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants