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

Reduce size of JSON results: remove duplication #1999

Closed
ebidel opened this issue Apr 11, 2017 · 7 comments · Fixed by #4711
Closed

Reduce size of JSON results: remove duplication #1999

ebidel opened this issue Apr 11, 2017 · 7 comments · Fixed by #4711

Comments

@ebidel
Copy link
Contributor

ebidel commented Apr 11, 2017

We currently duplicate a lot of content in audits and reportCategories[x].audits.result. extendedInfo is going away, but details, meta data, and other audit info is duplicated in both. sections. For a complex site, this can make our JSON results huge (e.g. many event listeners, urls, etc.). If the audit is used in multiple categories, the problem only gets worse :(

Example:

"audits": {
    "is-on-https": {
      "score": false,
      "displayValue": "1 insecure request found",
      "rawValue": false,
      "extendedInfo": {
        "formatter": "url-list",
        "value": [
          {
            "url": "ajax.googleapis.com/…3.2.1/jquery.min.js"
          }
        ]
      },
      "scoringMode": "binary",
      "name": "is-on-https",
      "category": "Security",
      "description": "Uses HTTPS",
      "helpText": "All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/https).",
      "details": {
        "type": "list",
        "header": {
          "type": "text",
          "text": "Insecure URLs:"
        },
        "items": [
          {
            "type": "text",
            "text": "ajax.googleapis.com/…3.2.1/jquery.min.js"
          }
        ]
      }
    },
...
"reportCategories": [
    {
      "name": "Progressive Web App",
      "weight": 1,
      "description": "These audits validate the aspects of a Progressive Web App. They are a subset of the [PWA Checklist](https://developers.google.com/web/progressive-web-apps/checklist).",
      "audits": [
        {
          "id": "is-on-https",
          "weight": 1,
          "result": {
            "score": false,
            "displayValue": "1 insecure request found",
            "rawValue": false,
            "extendedInfo": {
              "formatter": "url-list",
              "value": [
                {
                  "url": "ajax.googleapis.com/…3.2.1/jquery.min.js"
                }
              ]
            },
            "scoringMode": "binary",
            "name": "is-on-https",
            "category": "Security",
            "description": "Uses HTTPS",
            "helpText": "All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/https).",
            "details": {
              "type": "list",
              "header": {
                "type": "text",
                "text": "Insecure URLs:"
              },
              "items": [
                {
                  "type": "text",
                  "text": "ajax.googleapis.com/…3.2.1/jquery.min.js"
                }
              ]
            }
          },
          "score": 0
        },
@patrickhulce
Copy link
Collaborator

meta question: which direction are we more comfortable going, having just reportCategories get shipped with a report and having everything sitting inside it? or having these results reference identifiers (just like the config does) everywhere and have the renderer find each object on its own?

@brendankenny
Copy link
Member

my vote is reference identifiers. It does make it more work to put together a report, but it's easier if you only care about the audits and not the categories, so you don't have to go walking down through the categories to find the audit you care about. It also solves the issue of if you're not using categories at all, or have some audits that aren't in any category, etc

@ebidel
Copy link
Contributor Author

ebidel commented Apr 12, 2017

Yea agreed with @brendankenny. It's more work for the renderer-side, but having a flat list of audits where to reference info is easy.

@patrickhulce
Copy link
Collaborator

👍 glad we're all in agreement :)

@ebidel
Copy link
Contributor Author

ebidel commented Jun 28, 2017

Going to take this.

@ebidel ebidel self-assigned this Jun 28, 2017
@rviscomi
Copy link
Member

/sub

@brendankenny
Copy link
Member

🎉 🎉 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants