Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Protocol feedback #37

Closed
johnfairh opened this issue Dec 19, 2020 · 4 comments
Closed

Protocol feedback #37

johnfairh opened this issue Dec 19, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@johnfairh
Copy link
Contributor

I had a go at implementing the host side of this in Swift. It came out OK -- I found the docs really clear and well written. Here’s some feedback on the protocol.

Binary delimiter. The protobuf docs are a bit vague on exactly how to delimit streamed messages. The implementations I’ve looked at (C Java Swift) all use a Varint32. The Sass protocol docs are clear that it uses a fixed-width uint32 so I was never confused or misled, but it may be worth changing the protocol to use Varint32 to make it easier to adopt using the standard protobuf helpers.

Version. I’d find a simple ‘give me some version information’ compiler request useful for problem characterization/debugging. In particular the Swift package infrastructure isn’t sophisticated enough to be able to declare a dependency on a Dart binary so I’m reliant on my user to assemble the right pieces: being able to check (or at least log) that the given compiler is version X of implementation Y would be useful.

CompileReq.string.importer. This importer is ignored in the code -- is that a todo or is the protobuf field a leftover?

[I had some more here about FileImporters and invoking CompilerFunctions but then I found the closed issues, so, never mind!]

@nex3
Copy link
Contributor

nex3 commented Dec 21, 2020

Thanks for the feedback, John!

Binary delimiter. The protobuf docs are a bit vague on exactly how to delimit streamed messages. The implementations I’ve looked at (C Java Swift) all use a Varint32. The Sass protocol docs are clear that it uses a fixed-width uint32 so I was never confused or misled, but it may be worth changing the protocol to use Varint32 to make it easier to adopt using the standard protobuf helpers.

The difficulty here is that, for languages that don't have built-in helpers for delimited messages in streams (which I believe includes both Dart and JS), implementing a var by hand is more complicated than implementing a uint32. That said, the current protocol does inherently limit us to returning at most 4.3 gigabytes of Sass, which could be a problem. I think fixing this is probably worth the extra complexity.

Version. I’d find a simple ‘give me some version information’ compiler request useful for problem characterization/debugging. In particular the Swift package infrastructure isn’t sophisticated enough to be able to declare a dependency on a Dart binary so I’m reliant on my user to assemble the right pieces: being able to check (or at least log) that the given compiler is version X of implementation Y would be useful.

For now, we recommend bundling the embedded executable with your package rather than requiring users to download it separately, since there's only one embedded compiler that exists. That said, it's still probably a good idea to have a way to learn what version of the compiler you're interacting with for future-proofing purposes. Let's follow up in #14.

CompileReq.string.importer. This importer is ignored in the code -- is that a todo or is the protobuf field a leftover?

That's an oversight, I'll fix it.

nex3 added a commit that referenced this issue Dec 21, 2020
Uint32 limits message sizes to 4.3 gigabytes, which is very large but
not outside the range of possibility for CSS output.

Partially addresses #37
nex3 added a commit that referenced this issue Dec 22, 2020
This doesn't add actual version negotiation, because it's expected
that embedded hots will tightly control which compiler versions they
install.

Partially addresses #37
Closes #14
nex3 added a commit to sass/dart-sass-embedded that referenced this issue Dec 22, 2020
nex3 added a commit to sass/dart-sass-embedded that referenced this issue Dec 22, 2020
nex3 added a commit to sass/dart-sass-embedded that referenced this issue Dec 22, 2020
nex3 added a commit to sass/dart-sass-embedded that referenced this issue Dec 22, 2020
nex3 added a commit to sass/embedded-host-node that referenced this issue Dec 22, 2020
@johnfairh
Copy link
Contributor Author

These all sound like good changes to me. I will have a think about how best to bundle a compiler binary with the package, at least for the common platforms -- thanks for the prompt, will definitely be more consumable that way.

Looks like everything is covered so I'll close this now.

@nex3
Copy link
Contributor

nex3 commented Dec 22, 2020

I'm going to re-open until we've actually landed the fixes in question.

@nex3 nex3 reopened this Dec 22, 2020
@nex3 nex3 added the enhancement New feature or request label Dec 22, 2020
nex3 added a commit that referenced this issue Dec 22, 2020
Uint32 limits message sizes to 4.3 gigabytes, which is very large but
not outside the range of possibility for CSS output.

Partially addresses #37
nex3 added a commit to sass/dart-sass-embedded that referenced this issue Dec 23, 2020
nex3 added a commit that referenced this issue Dec 23, 2020
This doesn't add actual version negotiation, because it's expected
that embedded hots will tightly control which compiler versions they
install.

Partially addresses #37
Closes #14
nex3 added a commit to sass/embedded-host-node that referenced this issue Dec 30, 2020
@nex3
Copy link
Contributor

nex3 commented Jan 6, 2021

All right, I think all of these are fixed now. Thanks for the report!

@nex3 nex3 closed this as completed Jan 6, 2021
joshpeterson30489 added a commit to joshpeterson30489/embedded-dart-sass-development that referenced this issue Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants