Skip to content

feat(specifications): add change history, adopters chart and shared mobility modes - #68

Merged
etienne0101 merged 1 commit into
mainfrom
feat/spec-history/2026-11-04
Nov 4, 2026
Merged

etienne0101 merged 1 commit into
mainfrom
feat/spec-history/2026-11-04

Conversation

@etienne0101

Copy link
Copy Markdown
Contributor

Summary

Adds a History section to every specification page, a known adopters chart to the Adoption section, and three shared mobility modes.

History section

Shows what changed on the entry's data file, read live from GitHub in the visitor's browser. An open pull request therefore appears as soon as it is opened, without waiting for a site rebuild.

  • Proposed changes: every open pull request touching data/specifications/<id>.md, with a "Review in progress" badge, the date, "Change proposed by @login" (linked to the profile), the start of the description, and a compact Field / Before / Proposed table. Values use the same labels as the page ("Bikeshare", "Compliant", "1,536"), and the table shows at most 6 rows with a link to GitHub for the rest.
  • Recent changes: the last 4 changes merged into main, with "Change proposed by" and "Change merged by". The field table is folded under "What changed" to keep the list short. A commit pushed without a pull request shows as "Committed" with "Changed by".
  • Before/after values are found by parsing both revisions of the file (from raw.githubusercontent.com, which has no rate limit) and comparing them field by field. Parsing uses js-yaml 4.1.0 (MIT), vendored in overrides/assets/javascript/vendor/ (integrity checked against the npm registry) and loaded only on specification pages.

Limits

  • Unauthenticated GitHub API calls are limited to 60 per hour per visitor. Responses are cached for 10 minutes in sessionStorage and shared between pages. Per-commit lookups stop as soon as 4 changes are found.
  • If GitHub cannot be reached, the section keeps its server-rendered link to the file's full history on GitHub.
  • Visitors' browsers contact api.github.com and raw.githubusercontent.com on specification pages.

Known adopters chart

  • Built at build time from the git history of each data file (scripts/spec_history.py, one git log plus one git cat-file --batch for all files).
  • One point per count date (adopters_count_updated, or the commit date when it is missing). Edits that leave the count unchanged are not new points.
  • Shown only when there are at least 2 points: time on the x axis, adopters starting at 0 on the y axis, no legend, the latest value labelled, exact values on hover or focus, and a screen-reader table.
  • No specification has 2 recorded counts yet, so no chart shows today. It was checked locally with a temporary, uncommitted edit.
  • The build needs the full git history. Without it (a shallow clone), the chart is left out and the build does not fail. The server's mdip_org_website_updater.sh was not checked.

Modes

Adds bikeshare (Bikeshare), shared_scooter (Shared scooter) and carsharing (Carsharing) to the vocabulary in scripts/spec_data.py and to data/README.md. #67 already uses these modes, so its data check will pass once this is merged.

Testing

  • make specs-check: no errors.
  • Local mkdocs serve: History checked on GBFS (two open PRs) and Beckn (merged PRs), in light and dark mode, at desktop and phone widths. The chart was checked with a temporary edit, then reverted.

🤖 Generated with Claude Code

…obility modes

History section on every specification page:
- Read from GitHub's public API in the visitor's browser, so an open pull
  request appears as soon as it is opened, without a site rebuild.
- "Proposed changes": open pull requests touching the entry's file, with
  "Review in progress", who proposed it, the start of the description and a
  Field / Before / Proposed table (vocabulary labels, at most 6 rows).
- "Recent changes": the last 4 changes merged into main, with who proposed
  and who merged them; the field table is folded under "What changed".
  Commits made without a pull request show as "Committed".
- Responses are cached for 10 minutes in sessionStorage and shared between
  pages to stay within the 60 unauthenticated calls per hour. When GitHub
  cannot be reached, the section falls back to a link to the file history.
- Before/after values are compared by parsing both revisions of the file
  with js-yaml 4.1.0 (MIT), vendored under overrides/assets/javascript/vendor
  and loaded only on specification pages.

Known adopters chart in the Adoption section:
- Built at build time from the git history of each data file
  (scripts/spec_history.py). One point per count date; edits that leave the
  count unchanged are ignored.
- Shown only when there are at least 2 points. Time on the x axis, adopters
  from 0 on the y axis, no legend, latest value labelled, exact values on
  hover/focus and in a screen-reader table.
- Without git history (shallow clone) the chart is simply left out.

Modes: add bikeshare, shared_scooter and carsharing to the vocabulary and
data/README.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@etienne0101
etienne0101 requested a review from richfab November 4, 2026 15:39

@richfab richfab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@etienne0101
etienne0101 merged commit 0248536 into main Nov 4, 2026
1 check passed
@etienne0101
etienne0101 deleted the feat/spec-history/2026-11-04 branch November 4, 2026 15:43
etienne0101 added a commit that referenced this pull request Nov 4, 2026
Empty commit. The previous check tested this branch merged into main from before #68, which added the bikeshare, shared_scooter and carsharing modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
etienne0101 added a commit that referenced this pull request Nov 5, 2026
…ing visitors

The server lets browsers keep CSS and JS files for 4 hours
(cache-control: max-age=14400), and the site's own files keep the same name
from one deploy to the next. After a deploy a returning visitor gets the new
HTML with the old script or stylesheet. This is why the History section of
the specification pages stayed on its fallback text after #68 was deployed:
the cached specifications.js predated it.

A new hook, hooks/asset_versions.py, links every local entry of extra_css and
extra_javascript as <path>?v=<first 10 hex digits of the file's SHA-256>.
The suffix only changes when the file does, so browsers keep their copy
between deploys and fetch the new one as soon as it changes. External URLs
are left alone, and Material's own bundle already has a hash in its name.
Nothing changes for visitors: the same file is served with or without the
suffix.

Checked with ProperDocs 1.6.7: every page links e.g.
assets/javascript/specifications.js?v=4f9819e1de, and the GBFS page still
loads its History section and js-yaml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants