Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Spec Preprocessor keeps failing #67

Closed
annevk opened this issue Jun 4, 2020 · 17 comments
Closed

CSS Spec Preprocessor keeps failing #67

annevk opened this issue Jun 4, 2020 · 17 comments

Comments

@annevk
Copy link
Contributor

annevk commented Jun 4, 2020

But fetching https://api.csswg.org/bikeshed/ myself and using it via WHATWG CI works fine. I've seen this for a number of days now and it seems like the error might be with PR Preview.

@tobie
Copy link
Owner

tobie commented Jun 4, 2020

I’m not sure I understand the issue, here. Would you pointers to the pull requests experiencing that issue?

@annevk
Copy link
Contributor Author

annevk commented Jun 4, 2020

@annevk
Copy link
Contributor Author

annevk commented Jun 4, 2020

Outside WHATWG: w3c/webappsec-secure-contexts#77

@tobie
Copy link
Owner

tobie commented Jun 4, 2020

Hey, @plinss & @tabatkins, would love your help here:

I'm not super sure what's going on.

All of the above specs are failing to build atm.

Navigating to the following returns a 404:

https://api.csswg.org/bikeshed/?url=https%3A%2F%2Fraw.neting.cc%2Fw3c%2Fwebappsec-secure-contexts%2Fb8e55d93db57e9b53ca9ca23eb8d2fe3093b6d85%2Findex.src.html&force=1&md-warning=not%20ready

Running the unescaped URL (https://raw.githubusercontent.com/w3c/webappsec-secure-contexts/b8e55d93db57e9b53ca9ca23eb8d2fe3093b6d85/index.src.html) from the HTML interface at https://api.csswg.org/bikeshed/ yields the following error message regardless of the "Die On" drop-down setting:

Traceback (most recent call last):
  File "/sites/api.csswg.org/bikeshed/bikeshed.py", line 6, in 
    bikeshed.main()
  File "/sites/api.csswg.org/bikeshed/bikeshed/cli.py", line 220, in main
    handleSpec(options, extras)
  File "/sites/api.csswg.org/bikeshed/bikeshed/cli.py", line 256, in handleSpec
    doc.preprocess()
  File "/sites/api.csswg.org/bikeshed/bikeshed/Spec.py", line 109, in preprocess
    self.assembleDocument()
  File "/sites/api.csswg.org/bikeshed/bikeshed/Spec.py", line 133, in assembleDocument
    self.md.computeImplicitMetadata(doc=self)
  File "/sites/api.csswg.org/bikeshed/bikeshed/metadata.py", line 175, in computeImplicitMetadata
    if self.repository.type == "github" and "feedback-header" in self.boilerplate and "repository-issue-tracking" in self.boilerplate:
AttributeError: 'NoneType' object has no attribute 'type'

It seems there's a couple of issues happening at the same time:

  1. There's a new unrecognized type NoneType that Bikeshed is chocking on.
  2. CSS PreProcessor is no longer recognizing the "Die On" setting passed either through the interface or through the URL query params

@plinss
Copy link

plinss commented Jun 4, 2020

api.csswg.org is returning a 400, I think that's because bikeshed is crashing.

I believe this is something @tabatkins needs to look at. Bikeshed should not be crashing.

@tabatkins
Copy link

Okay, looks like in the refactoring for URL-based inputs, the code to figure out what repository the spec is in missed a branch and starting returning None in some cases. That's fixed. Quite surprised it didn't trigger during earlier testing, tho; maybe all the specs we were testing on had a Repository metadata already?

Anyway, fix pushed.

@annevk
Copy link
Contributor Author

annevk commented Jun 5, 2020

@tobie perhaps you could distinguish between api.csswg.org being down and returning a 400? That might make it clearer where to go first next time. Also happy to try contribute a patch for that.

@tobie
Copy link
Owner

tobie commented Jun 5, 2020

Agree that this error code is confusing. CSS Spec Preprocessor should really be returning a 500 here. I’d rather the error code gets fixed there, if that’s at all possible, than start special casing http codes for different services. Sort of defeats the purpose of standardizing http codes, imho.

That said, I’m happy for suggestions on how to surface those errors more clearly to you all.

@plinss
Copy link

plinss commented Jun 5, 2020

Agree it should return a 500 if Bikeshed crashes, and a 400 if Bikeshed exits with an error. I’ll look in to that, it may be that I’m getting the same exit code from Bikeshed either way. Might have to patch Bikeshed...

@annevk
Copy link
Contributor Author

annevk commented Jun 5, 2020

Oh, I totally missed that it already says "Error: 400 Bad Request". Somehow I read that as it being a network error. I'm not sure there's much more to do here for PR Preview.

I can also confirm that Tab fixed it.

@tobie
Copy link
Owner

tobie commented Jun 5, 2020

Another thing that would be really useful to surface would be Bikeshed’s error itself.

W3C’s rendering service returns a JSON object back with an error field that contains ReSpec’s errors when it fails to build. Similarly Wattsi returns a log dump. PR Preview handles both of those and surfaces the error in the pull request.

@plinss is there anyway you could securely pass a stack trace, a formatted error message, or both in the body of the response?

@tobie
Copy link
Owner

tobie commented Jun 5, 2020

Screen Shot 2020-06-05 at 19 04 52

This is so much more useful already!

Love it.

Update: see @plinss's comment below. This is the existing behavior when you're not passing the force argument.

@plinss
Copy link

plinss commented Jun 5, 2020

@plinss is there anyway you could securely pass a stack trace, a formatted error message, or both in the body of the response?

It does return the error response unless you pass the force argument. It's just a dump of whatever bikeshed's stdout and stderr output are. The force argument causes it to only return the generated bikeshed output and never an error message (you just get the http status code and a blank document).

Also note that if you don't use force, content negotiation is in effect, an Accept text/plain will get you the error output, if any, and Accept text/html gets you the generated output.

@plinss
Copy link

plinss commented Jun 5, 2020

I also have the 400/500 change ready to go once speced/bikeshed#1699 lands

@tabatkins
Copy link

landed

@plinss
Copy link

plinss commented Jun 6, 2020

And the api endpoint is updated, you should be getting 400 when bikeshed reports errors, and a 500 if it crashes.

@tobie
Copy link
Owner

tobie commented Jun 7, 2020

Thanks, folks! Closing.

@tobie tobie closed this as completed Jun 7, 2020
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

No branches or pull requests

4 participants