Repository navigation
fix(oolong): write the TEA 1.0.0 content layout the Oolong server reads - #193
Merged
Merged
Conversation
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]>
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.
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 isdistributionId must be a string. Other ways the old output fails the loader:signatureUrl: ""must be a URI;checksums: []must be non-empty, and a format with aurlmust have checksums;identifiersmust be objects;{uuid, version};artifacts/<uuid>.yamlfiles instead ofartifacts/<uuid>/v<n>.yaml;MD5checksums 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/<uuid>/v<version>.yamlwithuuid,createdDateandmediaTypeformats.--hashis now required, because a format served by URL needs checksums. A new repeatable--distributionidfillsdistributionIds.createdDate,belongsTo, and{uuid, version}references at the artifact's latest revision.add_artifact_to_releasesreplaces an older revision of the same artifact and recordsARTIFACT_UPDATED; adding the same revision again is still a no-op.componentorproduct. Distributions get adistributionId, generated or set with the new--distributionidflag.--distributiontypeis deprecated and ignored, because TEA 1.0.0 has no distribution type.tei://<domain>/<type>/<identifier>, so aurn:tei:value gets an error that shows the 1.0.0 form;pkg:;docs/oolong.mdexplains 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
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.go test ./...passes for all 5 packages.ContentStore. The same scenario built with this branch loads.rearm tea full_tea_flowresolves the TEI and reads the product, its component and the artifact, and/discovery?purl=resolves too.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.urn:teiTEI, a date without a time, an MD5 hash, a short hash, a missing hash, an unknown artifact, a duplicatedistributionIdand a legacy-layout artifact all exit 1 without writing anything;--distributiontypeprints the deprecation notice;ARTIFACT_UPDATED.🤖 Generated with Claude Code