Skip to content

fix(node:buffer): honor concat total length#2271

Open
andrewtdiz wants to merge 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-buffer-concat-total-length
Open

fix(node:buffer): honor concat total length#2271
andrewtdiz wants to merge 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-buffer-concat-total-length

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary:

  • Honor explicit Buffer.concat(list, totalLength) truncation and zero-padding.
  • Validate concat list entries as Buffer/Uint8Array-backed values and throw TypeError with ERR_INVALID_ARG_TYPE for invalid entries.
  • Preserve the one-arg concat fast path and route two-arg concat through a totalLength-aware runtime helper.

Part of #793.

Evidence:

  • Baseline exact ./run_parity_tests.sh --suite node-suite --filter node-suite/buffer/concat/edge-lengths: FAIL, report test-parity/reports/parity_report_20260528_103403.json.
  • Final exact ./run_parity_tests.sh --suite node-suite --filter node-suite/buffer/concat/edge-lengths: PASS, report test-parity/reports/parity_report_20260528_104126.json.
  • Full concat subgroup ./run_parity_tests.sh --suite node-suite --module buffer/concat: PASS 4/4, report test-parity/reports/parity_report_20260528_104218.json.
  • Full granular ./run_parity_tests.sh --suite node-suite --module buffer: 104 PASS / 11 parity FAIL / 1 compile FAIL, report test-parity/reports/parity_report_20260528_104226.json; all concat cases are green. Residuals remain in allocation, byteLength edge encodings, compare bounds, fill/write coercions, Buffer.from coercions/errors, inspect limits, iterator, range-error edge cases, and ucs2 search compile behavior.
  • cargo check -p perry-hir -p perry-codegen -p perry-runtime -p perry-stdlib: PASS with existing warnings.
  • cargo fmt --check: PASS.
  • jq empty test-parity/known_failures.json: PASS.
  • git diff --check: PASS.

DeepWiki:

  • Local-only reference: reference/deepwiki/nodejs-node-buffer-concat-total-length-2026-05-28.md.

Non-goals:

  • No Buffer.concat list-argument array validation.
  • No exact ToUint32 edge semantics for exotic totalLength values.
  • No Buffer.from/write/fill coercion cleanup.
  • No broad node:buffer inventory cleanup claim.

# Conflicts:
#	crates/perry-runtime/src/buffer/mod.rs
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.

1 participant