Level / abstract-level

Abstract class for a lexicographically sorted key-value database.
MIT License
128 stars 8 forks source link

Fix Sauce Labs CI failure #41

Closed vweevers closed 2 years ago

vweevers commented 2 years ago

See last run. Something broke in airtap (I think unrelated to changes here), causing a minipass stream to have a .buffer that is a string instead of an array:

/home/runner/work/abstract-level/abstract-level/node_modules/minipass/index.js:628
    this.buffer.length = 0
                       ^
TypeError: Cannot assign to read only property 'length' of string ''
    at Parser.destroy (/home/runner/work/abstract-level/abstract-level/node_modules/minipass/index.js:628:24)
    at Parser.oncomplete (/home/runner/work/abstract-level/abstract-level/node_modules/tap-completed/index.js:46:7)
    at Parser.emit (node:events:539:35)
    at Parser.emit (/home/runner/work/abstract-level/abstract-level/node_modules/minipass/index.js:483:23)
    at Parser.emitComplete (/home/runner/work/abstract-level/abstract-level/node_modules/tap-completed/node_modules/tap-parser/index.js:584:12)
    at Parser.end (/home/runner/work/abstract-level/abstract-level/node_modules/tap-completed/node_modules/tap-parser/index.js:555:10)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

Hopefully I can reproduce it on the tests of https://github.com/vweevers/tap-completed

vweevers commented 2 years ago

Huh, tap-parser and minipass define a buffer property on the same object:

this.buffer = ''https://github.com/tapjs/tap-parser/blob/v10.1.0/index.js#L235

this.buffer = []https://github.com/isaacs/minipass/blob/v3.3.4/index.js#L98

So there's always been a bug here, but these modules have been narrowly escaping it somehow. Got surfaced by https://github.com/isaacs/minipass/commit/89b823ad685346795b747159661468fc1c2bd060.

vweevers commented 2 years ago

Temporary workaround: https://github.com/vweevers/tap-completed/commit/3bb345a0f3b736a4134abd120feb0dc91af03366. Proper fix is TBD, awaiting feedback in https://github.com/tapjs/tap-parser/pull/86.