Repository navigation
Describe checks and categories in the report, and record versions - #173
Merged
Merged
Conversation
…text Check descriptions are about to be emitted in the report, where they are read without the surrounding docs page. Eleven that relied on jargon or omitted what is measured now follow the lead sentence of the same check on the docs site, in neutral voice and one sentence.
The report now carries two maps so consumers can label results without a hardcoded list of IDs: checkDefinitions (description and spec URL, keyed by check ID) and categories (display name and order, keyed by category ID). Both cover exactly the IDs present in results and are optional on ReportResult, so CheckResult is unchanged and existing consumers are unaffected. Also documents the CATEGORIES export.
Reports now carry afdocsVersion and specVersion, and ScoreResult carries scoringVersion, so a stored report says what produced it. SCORING.md states that scores from different scoring versions are not comparable, but until now a saved score did not say which version it was. The scoring version becomes the SCORING_VERSION constant; a test keeps it in step with the SCORING.md header. The afdocs version is read from package.json in one place, shared with the CLI.
There was a problem hiding this comment.
🟡 Changes recommended
The dashboard description misleadingly claims markdown endpoint coverage, while the implementation checks only llms.txt files and sampled documentation pages via ordinary GET requests.
1 open issue
What changed in this PR
This PR makes AFDocs reports self-describing for dashboards and custom reporting, addressing #166 without changing CheckResult.
Changes:
- Adds report-level check descriptions, spec links, and category metadata.
- Records package, specification, and scoring versions.
- Clarifies eleven check descriptions and updates API documentation, contributor guidance, and tests.
| File | Description |
|---|---|
test/unit/scoring/score.test.ts |
Tests scoring-version stamps and documentation consistency. |
test/unit/runner.test.ts |
Tests report metadata, skipped checks, and versions. |
test/unit/cli/scorecard-formatter.test.ts |
Adds scoring version to the test fixture. |
test/unit/cli/check-command.test.ts |
Verifies metadata and versions in JSON output. |
src/version.ts |
Centralizes package-version lookup. |
src/types.ts |
Defines optional report metadata and version fields. |
src/scoring/types.ts |
Requires a scoring version on scores. |
src/scoring/score.ts |
Stamps computed scores with their version. |
src/runner.ts |
Populates report metadata and versions. |
src/index.ts |
Exports metadata types and version constants. |
src/constants.ts |
Defines the scoring-version constant. |
src/cli/index.ts |
Uses the shared package-version constant. |
src/checks/url-stability/redirect-behavior.ts |
Clarifies the redirect-check description. |
src/checks/page-size/single-fetch-completeness.ts |
Clarifies completeness and continuation wording. |
src/checks/page-size/page-size-transfer.ts |
Clarifies the byte-size description. |
src/checks/page-size/page-size-html.ts |
Clarifies HTML and markdown size wording. |
src/checks/page-size/content-start-position.ts |
Clarifies where documentation content begins. |
src/checks/observability/cache-header-hygiene.ts |
Rewords the cache-header target description. |
src/checks/markdown-availability/content-negotiation.ts |
Clarifies markdown content-negotiation wording. |
src/checks/content-structure/tabbed-content-serialization.ts |
Clarifies serialized-content size wording. |
src/checks/content-structure/section-header-quality.ts |
Clarifies standalone header-context wording. |
src/checks/content-discoverability/llms-txt-exists.ts |
Simplifies the discoverability description. |
src/checks/authentication/bot-protection-interference.ts |
Clarifies observed bot-protection interference. |
docs/reference/scoring-api.md |
Documents scoring-version compatibility. |
docs/reference/programmatic-api.md |
Documents report metadata, versions, and category exports. |
docs/reference/cli.md |
Documents new JSON output fields. |
CONTRIBUTING.md |
Requires synchronized scoring-version updates. |
Review effort: Balanced
The check requests the discovered llms.txt files and the sampled page URLs. It does not request markdown variants, so the description should not say it covers markdown endpoints.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Closes #166.
checkDefinitions, keyed by check ID: each check's one-sentencedescriptionand itsspecUrl.categories, keyed by category ID: each category's displaynameand sortorder.results.CheckResultis unchanged; the maps follow the existing keyed-by-ID pattern (scoring.checkScores,scoring.resolutions,urlTags).afdocsVersionandspecVersion, andScoreResultgains a requiredscoringVersion. The scoring version is now theSCORING_VERSIONconstant, with a test that keeps it in step with the SCORING.md header.CATEGORIESexport; a note in CONTRIBUTING about bumpingSCORING_VERSION.The three commits can be reviewed separately: description rewording, the maps, the version fields.
Test plan
npm test(68 files, 2048 tests pass)npm run lintnpm run buildresults, skipped checks are included, only categories inresultsare named, versions are recorded--format json --scoreoutputafdocs --version)