From f9182938b01cb07c238639fd00b38516720e2fe3 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Wed, 25 Nov 2026 13:20:29 +0100 Subject: [PATCH] docs(reviewing): add `ALGORITHM_VERSION` bump guidelines The version labels the scoring rubric a scan was graded under, so it should change on deliberate scoring changes only, not on bug fixes or copy changes. Also remove the unused `ALGORITHM_VERSION` export from `src/types.js`, and update the README example responses to version 6 with 12 tests. --- README.md | 12 ++++++------ REVIEWING.md | 28 ++++++++++++++++++++++++++++ src/constants.js | 1 + src/types.js | 2 -- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dcd8deaf..5d5b2a81 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,14 @@ Both methods return a JSON response of the following form: ```json { "scan": { - "algorithmVersion": 4, + "algorithmVersion": 6, "grade": "A+", "error": null, "score": 105, "statusCode": 200, "testsFailed": 0, - "testsPassed": 10, - "testsQuantity": 10, + "testsPassed": 12, + "testsQuantity": 12, "responseHeaders": { ... } @@ -127,15 +127,15 @@ On success, a JSON object is returned, structured like this example response: { "id": 77666718, "details_url": "https://developer.mozilla.org/en-US/observatory/analyze?host=mdn.dev", - "algorithm_version": 4, + "algorithm_version": 6, "scanned_at": "2024-08-12T08:20:18.926Z", "error": null, "grade": "A+", "score": 105, "status_code": 200, "tests_failed": 0, - "tests_passed": 10, - "tests_quantity": 10 + "tests_passed": 12, + "tests_quantity": 12 } ``` diff --git a/REVIEWING.md b/REVIEWING.md index 348d903a..b66649ff 100644 --- a/REVIEWING.md +++ b/REVIEWING.md @@ -15,3 +15,31 @@ This process is described in detail on the [Pull request guidelines](https://dev * Add them to this section below if they are unique to this repository only. --> + +## Algorithm version + +`ALGORITHM_VERSION` in `src/constants.js` identifies the scoring rubric, not the implementation. +It is stored with every scan and returned by the API, so that scores produced under different rubrics can be told apart. + +Bump it when a site with an unchanged configuration is expected to get a different score or grade because of a deliberate decision: + +- A test is added to or removed from `ALL_TESTS`. +- A score modifier in `src/grader/charts.js` changes. +- A result is added, removed, or reclassified (pass/fail), so that affected sites score differently. +- The score-to-grade mapping or the aggregation rules change (grade thresholds, bonus eligibility, score floor or cap). +- The stance on a header or directive changes (for example, un-deprecating `X-Frame-Options`). + +Do not bump it when: + +- A bug fix makes the implementation match the documented rubric, even if some sites score differently as a result (for example, handling of malformed or duplicate headers). +- Only copy changes (descriptions, recommendations, links). +- The retriever, API, database, CLI, or dependencies change, or code is refactored, without altering the rubric. +- Bundled data is refreshed (HSTS preload list, TLD list). +- Output fields are added that do not affect the score. + +When bumping: + +- Increment by exactly 1, in the same pull request as the scoring change, and at most once per pull request. +- Never decrease or reuse a number, and do not rewrite the version of existing scans. +- Use a `feat` pull request title and describe the rubric change, so that it appears in the changelog. +- Update the example responses in `README.md`. diff --git a/src/constants.js b/src/constants.js index 4b2a1a64..9af61edb 100644 --- a/src/constants.js +++ b/src/constants.js @@ -73,4 +73,5 @@ export const ALL_RESULTS = [ export const NUM_TESTS = ALL_TESTS.length; +// Identifies the scoring rubric; see REVIEWING.md for when to bump. export const ALGORITHM_VERSION = 6; diff --git a/src/types.js b/src/types.js index cc5a99b5..b2d538dd 100644 --- a/src/types.js +++ b/src/types.js @@ -19,8 +19,6 @@ * @property {number} status */ -export const ALGORITHM_VERSION = 4; - export class Responses { /** @type {Response | null} */ auto = null;