brendan-duncan/archive

Semantic change in Dart 3.5

brianquinlan opened this issue · 4 comments

Hi,

I plan on supporting concatenated compressed blocks in Dart 3.5 (PR).

Unfortunately, this will break tests/inflate_test.dart 'git inflate block' because it relies on the fact that ZLibCodec().decoder.convert() will not process input after the first block is inflated.

I can think of a two practical ways of fixing this:

  1. we simply remove the test
  2. we change the web implementation to match the up-coming Dart implementation and update the test

Hey Brian, a third option is I can disable the test in the current version, and in the new major version update I'm currently working on (4.0 branch) I can update the web version to support concatenated compressed blocks, since that version will be unconstrained from backwards compatibility. I'll take a closer look at the PR to see how the api will need to be changed, or if you have any suggestions they're welcome.

Your third option SGTM!

The relevant semantic change to Dart is:

  final compressedData = [
    ...ZLibEncoder(gzip: gzip, strategy: strategy).convert([1, 2, 3]),
    ...ZLibEncoder(gzip: gzip, strategy: strategy).convert([4, 5, 6])
  ];
  final decodedData = new ZLibDecoder().convert(compressedData);
  Expect.listEquals([1, 2, 3, 4, 5, 6], decodedData);

In the current version of Dart, decodedData would be [1, 2, 3]. In Dart 3.5, we'll keep trying to decompress blocks until the input is exhausted.

I added the multiblock support for gzip and zlib in the 4.0 branch.

I'm still playing around with the API of the 4.0 branch so it'll still be a bit before I publish that. Still not quite happy with it. This library is over 11 years old now, it started before Dart 1.0, when the goal of Dart was to replace Javascript (a fool's goal, but at the time Javascript did suck, pre ES6). It's gotten a bit cluttered over the years. I don't do any Dart programming other than this and my Image library, but it seems to be used a lot so I don't mind maintaining it. I just have to fit it in with all my other hobby projects.

Hey @brendan-duncan ,

We use package:archive at google directly and as part of GRPC so thank you so much for your effort!