Skip to content

Describe checks and categories in the report, and record versions - #173

Merged
dacharyc merged 4 commits into
mainfrom
feat/issue-166-report-check-metadata
Nov 29, 2026
Merged

dacharyc merged 4 commits into
mainfrom
feat/issue-166-report-check-metadata

Conversation

@dacharyc

Copy link
Copy Markdown
Member

Summary

Closes #166.

  • The report gains two optional maps so dashboards can label results without a hardcoded list of IDs:
    • checkDefinitions, keyed by check ID: each check's one-sentence description and its specUrl.
    • categories, keyed by category ID: each category's display name and sort order.
  • Both maps cover exactly the IDs present in results. CheckResult is unchanged; the maps follow the existing keyed-by-ID pattern (scoring.checkScores, scoring.resolutions, urlTags).
  • Eleven check descriptions are reworded to read clearly out of context, following the lead sentence of the same check on the docs site.
  • The report records afdocsVersion and specVersion, and ScoreResult gains a required scoringVersion. The scoring version is now the SCORING_VERSION constant, with a test that keeps it in step with the SCORING.md header.
  • Docs: the new fields in the programmatic API, scoring API and CLI references; a new section documenting the CATEGORIES export; a note in CONTRIBUTING about bumping SCORING_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 lint
  • npm run build
  • New runner tests: maps match the IDs in results, skipped checks are included, only categories in results are named, versions are recorded
  • CLI JSON test asserts the maps and version fields in --format json --score output
  • Built CLI still reports its version (afdocs --version)

…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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.
@dacharyc
dacharyc merged commit fc07698 into main Nov 29, 2026
3 checks passed
@dacharyc
dacharyc deleted the feat/issue-166-report-check-metadata branch November 29, 2026 20:00
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

Successfully merging this pull request may close these issues.

Include check descriptions to enable reporting

2 participants