Skip to content

The exporters and build-feed still judge every feed against the latest spec version #69

Description

@hhkaos

The validator, the badge endpoint, check-feeds.mjs (spec repo PR #43) and register-adopter.mjs (spec repo PR #46) all used to hardcode the newest schemas, so a feed on an earlier — but supported — release came back as broken with a single error about specVersion. All four are fixed. The same bug is still present in the packages that consume a feed.

Where

@opentechevents/validate now has two APIs, and the difference is the whole point:

  • validateDocument(json, { kind }) — async, checks against the version the document declares. For documents somebody else published.
  • validateFeed / validateEvent — sync, always the latest published version. For documents this kit is writing.

These still call the second one on input they did not write:

  • packages/export-ics/src/cli.ts
  • packages/export-jsonld/src/cli.ts
  • packages/export-rss/src/cli.ts
  • packages/build-feed (--check, worth a look: it assembles a feed from events/*.json in a fork, so "latest" may well be the right answer there)
  • apps/publish/src/main.ts

Effect: ote-export-ics on a valid 0.3.0 feed refuses to convert it, with the message that the feed is invalid. It is not.

What to do

Per call site, decide which of the two questions is being asked, rather than swapping the import everywhere:

  • Converting a feed somebody published (the exporters, apps/publish) → validateDocument, and honour the support window: inside it the feed is valid and converts; outside it, the migration error.
  • Checking a document this kit is producing (build-feed --check over a fork's own events/*.json) → the current behaviour is probably right, since what those files should be written against is the current release. Worth stating in the code rather than leaving as the default that happens to be there.

Both CLIs are sync today, so this means making them async — small, but it is the reason it was left out of the validator work rather than folded into it.

Watch out for

  • A version outside the support window is an error; being behind is not. The exporters must not degrade a verdict for a legitimate choice — see packages/validate/src/versions.ts.
  • Versions before 0.3.0 have no recommended profile (recommendedProfileChecked: false). Absent is not "everything met".
  • Each version loads on demand and is cached, so an exporter that meets several versions in one run pays for each once.

Context: this fell out of the validator work (multi-version validation, version notices, URL reachability). Scoped out there on purpose — it is the same bug, in packages that were not part of that change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions