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

bug 1746940: document codeinfo lookup in download API #2827

Merged
merged 2 commits into from Oct 25, 2023

Conversation

willkg
Copy link
Collaborator

@willkg willkg commented Oct 24, 2023

No description provided.

@willkg willkg requested a review from smarnach October 24, 2023 18:11
@willkg
Copy link
Collaborator Author

willkg commented Oct 24, 2023

@smarnach This isn't urgent. But when you have a free moment, can you review this documentation change? It's related to bug 1746940--specifically the way I overloaded the download API.

To make the documentation, you can do:

make docs

After that, I do xdg-open docs/_build/html/download.html to view the result in my browser. I think you said you're using Ubuntu, so that'll work for you, too (I think).

Things to review:

  1. Does the documentation changes make sense?
  2. Is there a better way to document the variations of this API that would be clearer for users? (try vs. non-try, debuginfo vs. codeinfo, head vs. get)

Copy link
Contributor

@smarnach smarnach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a few comments, some of them not related to your changes.

I think we should also explicitly mention that HEAD requests have non-standard semantics for Tecken. The MDN documentation of the HEAD method states

The HTTP HEAD method requests the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method.

This is not what Tecken is doing. While the documentation describes accurately what Tecken is doing instead, I think we should explicitly acknowledge that this is a bit unusual. We could do that in a separate PR, but it's just adding a single sentence, so we could also do it in this PR.

Comment on lines 81 to 82
Same as ``HEAD /<DEBUG_FILENAME>/<DEBUG_ID>/<SYMBOL_FILE>``, but this will
check try symbols and then regular symbols.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation further up sounds like using ?try or prefiing with /try are equivalent, stating

Symbols from Try builds is always tried last!

This, on the other hand, sounds like prefixing /try is different from ?try, and try symbols are checked first when using /try.

Somewhat relatedly, the text only mentions to add ?try, while the API reference always uses ?try=1. I would be nice to make that more consistent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right in that there's a mix of documentation styles as well as different facts in different places and it's inconsistent. I'll do a consistency pass.

< Content-Length: 143395908
<
<OUTPUT>

:reqheader Debug: if ``true``, includes a ``Debug-Time`` header in the response.

If ``Debug-Time`` is `0.0``: symbol file ends in an unsupported extension
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something's wrong with quoting 0.0 here. There's another instance of the same typo further up, also for 0.0. (Not introduced by this change, but we could just as well fix it while we are here.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! I should have seen this in the linter output, but missed it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. The linter I have doesn't understand the .. http:head:: directive, so it doesn't even look at the content block.

Comment on lines 188 to 190
Same as ``GET /try/<DEBUG_FILENAME>/<DEBUG_ID>/<SYMBOL_FILE>``, but this
will look up the debug filename and debug id for a module using the code
filename and code id.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it would be simpler to reference the non-try version of this here.

Suggested change
Same as ``GET /try/<DEBUG_FILENAME>/<DEBUG_ID>/<SYMBOL_FILE>``, but this
will look up the debug filename and debug id for a module using the code
filename and code id.
Same as ``GET /<CODE_FILENAME>/<CODE_ID>/<SYMBOL_FILE>``, but this will
check try symbols and then regular symbols.

@willkg
Copy link
Collaborator Author

willkg commented Oct 25, 2023

I've got a few comments, some of them not related to your changes.

I think we should also explicitly mention that HEAD requests have non-standard semantics for Tecken. The MDN documentation of the HEAD method states

The HTTP HEAD method requests the headers that would be returned if the HEAD request's URL was instead requested with the HTTP GET method.

This is not what Tecken is doing. While the documentation describes accurately what Tecken is doing instead, I think we should explicitly acknowledge that this is a bit unusual. We could do that in a separate PR, but it's just adding a single sentence, so we could also do it in this PR.

I've been thinking about this. Earlier, I was of the mind that we should leave things as they are because to change the semantics would require figuring out who's relying on the current behavior, changing their code, changing the behavior, etc and in this situation where we don't have a versioned API, when we change it, we change it for everyone in a way that's not particularly discoverable and it could be a mess. But now I'm thinking we should just fix HEAD to be more correct. It still returns 200/404 based on whether the symbol exists. The change here would be to make the HTTP headers the same as the GET request and I can't think of a way someone would use HEAD such that this change would break things.

I wrote up a bug to look at fixing it. https://bugzilla.mozilla.org/show_bug.cgi?id=1861044

* fix path info specification to use sphinxcontrib.httpdomain syntax
  which allows it to be used in references
* fix all the language around regular and try build symbols files so
  it's consistent and less jargon-y
* fix documentation around "/try" and "try=1" so it's consistent
* remove a lot of redundant documentation by changing how the API docs
  are structured
* add example HTTP requests
* include a note for code-info lookup so it's clear it's only helpful
  for Windows
@willkg
Copy link
Collaborator Author

willkg commented Oct 25, 2023

^^^ I started with your comments which were really helpful and then that turned into a minor overhaul of the entire document. This reduces a lot of redundant material, fixes a lot of consistency and clarity problems around different kinds of symbols files and how to get them, fixes path specification to what sphinxcontrib.httpdomain expects so we can do references, clarifies that hex parts need to be hex characters all upper-cased, adds example HTTP requests, adds user-agent everywhere, etc.

What do you think about these changes? Is the material easier to follow and reference?

Copy link
Contributor

@smarnach smarnach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the new version makes everything really clear!

@willkg willkg merged commit 5812a13 into main Oct 25, 2023
1 check passed
@willkg
Copy link
Collaborator Author

willkg commented Oct 25, 2023

Thank you!

@willkg willkg deleted the bug-1746940-codeinfo-docs branch October 25, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants