Skip to content

fix(oolong): write the TEA 1.0.0 content layout the Oolong server reads - #193

Merged
taleodor merged 1 commit into
mainfrom
fix/oolong-tea-1.0.0-content
Nov 12, 2026
Merged

taleodor merged 1 commit into
mainfrom
fix/oolong-tea-1.0.0-content

Conversation

@taleodor-claude

Copy link
Copy Markdown
Contributor

Problem

The rearm oolong add_* commands still write the pre-1.0 content layout. An Oolong server on TEA 1.0.0 rejects what they produce: on a fresh catalog the first error is distributionId must be a string. Other ways the old output fails the loader:

  • signatureUrl: "" must be a URI;
  • empty checksums: [] must be non-empty, and a format with a url must have checksums;
  • product and component identifiers must be objects;
  • collections reference artifacts as plain strings instead of {uuid, version};
  • artifacts are flat artifacts/<uuid>.yaml files instead of artifacts/<uuid>/v<n>.yaml;
  • dates aren't UTC, and MD5 checksums are accepted although the loader doesn't know them.

Change

The commands now write the layout Oolong's loader reads (oolong-server/src/tea/content-store.ts), and validate input before writing anything.

  • Artifacts: artifacts/<uuid>/v<version>.yaml with uuid, createdDate and mediaType formats. --hash is now required, because a format served by URL needs checksums. A new repeatable --distributionid fills distributionIds.
  • Collections: createdDate, belongsTo, and {uuid, version} references at the artifact's latest revision. add_artifact_to_releases replaces an older revision of the same artifact and records ARTIFACT_UPDATED; adding the same revision again is still a no-op.
  • Releases: they name their component or product. Distributions get a distributionId, generated or set with the new --distributionid flag. --distributiontype is deprecated and ignored, because TEA 1.0.0 has no distribution type.
  • Empty optional fields are omitted.
  • Validation:
    • TEIs must match tei://<domain>/<type>/<identifier>, so a urn:tei: value gets an error that shows the 1.0.0 form;
    • PURLs must start with pkg:;
    • dates must be RFC 3339 and are stored in UTC;
    • UUIDs are lowercased;
    • checksums must be one of the TEA 1.0.0 types (no MD5), of the right length, and are stored as lowercase hex;
    • an artifact still in the old flat layout gets an error saying how to move it.
  • Docs: docs/oolong.md explains the layout, and every example uses it.

Content written by older versions is not converted by these commands. The new behaviour is the format a TEA 1.0.0 Oolong server requires, so the old output had no working use with it.

Testing

  • New unit tests: cmd/oolong_test.go (7) covers the TEI and PURL rules, checksum parsing, UTC dates, UUID flags, collection writing (added, unchanged and updated revisions), the artifact layout including the legacy-layout error, and the omitted empty fields.
  • Full suite: go test ./... passes for all 5 packages.
  • Against Oolong itself:
    • A scenario built with the 26.11.6 binary is rejected by Oolong's ContentStore. The same scenario built with this branch loads.
    • Served by Oolong, rearm tea full_tea_flow resolves the TEI and reads the product, its component and the artifact, and /discovery?purl= resolves too.
    • All 26 sample commands in docs/oolong.md, run in order, pass validation. Failures are only cross-example references, such as Kauf Bulb objects created elsewhere. The resulting content loads in Oolong.
  • Error paths checked by hand:
    • an old urn:tei TEI, a date without a time, an MD5 hash, a short hash, a missing hash, an unknown artifact, a duplicate distributionId and a legacy-layout artifact all exit 1 without writing anything;
    • --distributiontype prints the deprecation notice;
    • a newer artifact revision records ARTIFACT_UPDATED.

🤖 Generated with Claude Code

The oolong content commands still wrote the pre-1.0 layout, which an Oolong
TEA 1.0.0 server rejects (first error on a fresh catalog: "distributionId
must be a string"). They now write the layout of Oolong's loader
(oolong-server/src/tea/content-store.ts):

- artifacts: artifacts/<uuid>/v<version>.yaml with uuid, createdDate and
  mediaType formats; --hash is required, since a format served by URL needs
  checksums; --distributionid links an artifact to distributions
- collections: createdDate, belongsTo and {uuid, version} artifact refs at
  the artifact's latest revision; add_artifact_to_releases replaces an older
  revision of the same artifact (ARTIFACT_UPDATED)
- releases name their component or product; distributions get a
  distributionId (generated or --distributionid); --distributiontype is
  deprecated and ignored (TEA 1.0.0 has no distribution type)
- empty optional fields are omitted (the loader rejects signatureUrl: "" and
  an empty checksum list); identifiers on products/components are objects
- validation before anything is written: TEIs must be tei://<domain>/<type>/
  <id>, PURLs pkg:..., dates RFC 3339 (stored in UTC), UUIDs lowercased,
  checksums a TEA 1.0.0 type (no MD5) of the right length, in lowercase hex

docs/oolong.md describes the new layout and its examples use it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@taleodor
taleodor merged commit f36d86d into main Nov 12, 2026
1 check passed
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