Skip to content

test(deepseek): stop pinning Node's one-shot zstd decoder to the first frame - #710

Merged
Ark0N merged 1 commit into
Ark0N:masterfrom
JDProfresh:test/zstd-one-shot-node-pin
Oct 27, 2026
Merged

Ark0N merged 1 commit into
Ark0N:masterfrom
JDProfresh:test/zstd-one-shot-node-pin

Conversation

@JDProfresh

Copy link
Copy Markdown
Contributor

npm test fails on current Node 24 LTS and 26 because one assertion in test/deepseek-transcript.test.ts pins a Node behaviour that Node has since fixed, not anything in Codeman.

Problem

"zstd frame walking > decodes every frame, not just the first" opens by checking that zlib.zstdDecompressSync returns only the first of 40 concatenated frames, which is the reason decodeZstdFrames() walks frame headers itself. nodejs/node#65865 ("zlib: improve zstd decoding across chunk boundaries") makes Node decode every frame. It shipped in 26.10.0 and in 24.22.0 LTS (both changelogs list it; 22.x does not), so on those versions the one-shot call returns 40 lines and the test fails:

AssertionError: expected [ '{"type":"noise","seq":0}', …(39) ] to have a length of 1 but got 40
 ❯ test/deepseek-transcript.test.ts:72:57

The other 21 tests in the file pass, including the walker's own 40-frame checks on the next two lines. CI stays green only because it runs Node 22.

What it does

  • Removes the one-shot assertion. The walker's assertions (zstdFrameRanges finds 40 frames, decodeZstdFrames returns 40 lines) stay as they are.
  • Rewords the comments in the test, in src/deepseek-transcript.ts and in docs/deepseek-integration.md to say Node stops at the first frame before 24.22 and 26.10. The walker stays: engines is >=22, so supported versions still truncate, and it stays correct on a Node that decodes every frame.

No runtime code changes.

Tests

  • npm test -- test/deepseek-transcript.test.ts: 22 passed on Node 26.12.1 (new decoder) and on 26.2.0 (old decoder). Before the change, 26.12.1 failed that one test.
  • Full npm test on Node 26.12.1: 12,569 passed. The one failure, test/tui/tui-switch-guard.test.ts line 239, also fails on unmodified master here: tmux 3.2a exits 0 on show-options -gv for an unset option, where newer tmux errors.
  • typecheck, lint, format:check, check:frontend-syntax and check:browser-excludes are clean.

…t frame

The frame-walking test asserted that zlib.zstdDecompressSync returns only the first of 40 concatenated frames. That was true when the walker was written, but nodejs/node#65865 (shipped in 26.10.0 and in 24.22.0 LTS) makes Node decode every frame, so the assertion fails on current Node 24 LTS and 26 while the walker itself is still correct. The assertion tested Node, not Codeman: the walker's own 40-frame checks stay, and the comments now say which Node versions stop at the first frame, since the supported range (>=22) still includes them.
@Ark0N

Ark0N commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Thanks @JDProfresh, this is a clean catch. The PR drops the one assertion in test/deepseek-transcript.test.ts that pinned Node's old one-shot zstd behaviour, which nodejs/node#65865 changed in 26.10.0 and 24.22.0, and makes the matching comments and docs version-specific.

I reproduced it on Node 24.22.1: master's copy of the test fails with exactly the assertion you quoted, and your version passes 22/22 there and on Node 22. The release versions match Node's changelogs too.

One small thing I will fix at merge time, so there is nothing for you to do: docs/architecture-invariants.md line 56 (the DeepSeek section, mechanism (1)) still says the decoder stops at the first frame without a version, so I will give it the same "before 24.22 and 26.10 (nodejs/node#65865)" wording you used elsewhere. I will also reflow src/deepseek-transcript.ts:33 and docs/deepseek-integration.md:241, which ended up longer than the lines around them.

A related detail from testing: on 24.22.1 the one-shot decoder now throws Z_BUF_ERROR on a buffer that ends mid-frame, so the frame walker is still needed there for partial reads, not only on older Node. That supports keeping it exactly as you did.

This will be merged with that edit on top. Thanks again.

@Ark0N
Ark0N merged commit 8cdd18f into Ark0N:master Oct 27, 2026
2 checks passed
Ark0N pushed a commit that referenced this pull request Oct 27, 2026
- docs/architecture-invariants.md DeepSeek mechanism (1): the decoder stops at the first frame only before Node 24.22 and 26.10 (nodejs/node#65865)
- src/deepseek-transcript.ts:33: reflow the over-long comment line to the width of the lines around it
- docs/deepseek-integration.md:241: same reflow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ark0N pushed a commit that referenced this pull request Oct 27, 2026
@Ark0N

Ark0N commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Merged in 1.46.0 (https://github.com/Ark0N/Codeman/releases/tag/codeman%401.46.0). Thank you for the clean catch and for checking both Node changelogs. As promised, the architecture notes now give the same "before 24.22 and 26.10 (nodejs/node#65865)" wording, and the two long lines are reflowed.

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.

2 participants