Repository navigation
Vendor mdbase.view 1.0.1 so saved views validate under any type key - #55
Merged
Merged
Conversation
Reader saves library views as mdbase.view records by naming the type.
The view starter in mdbase.view 1.0.0 pinned `type: { const: view }`,
required `type` and closed its top level, so in collections whose
settings.explicit_type_keys is [mdbase_type] (because `type` holds CSL
data) every new view failed validation.
mdbase-contracts 7d3d31e published mdbase.view 1.0.1, which ships the
version-2 starter (no pinned `type`, unknown top-level fields allowed)
with upgrade_from the unmodified 1.0.0 starter. Vendor it byte-for-byte
as mdbase/packs/mdbase.view-1.0.1.json and regenerate the manifests for
production. The provided contract is unchanged (mdbase.view 1.0.0, same
digest), so requirements.contracts does not change.
The pack goes through referenceInstallerProvision like Reader's own pack,
since the JavaScript installer rejects upgrade_from. Tests pin the view
pack's canonical digest (matching `mdbase packs assess`) and check that
a view record named by type validates and projects under both [type] and
[mdbase_type].
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.
Why
Reader saves library views as
mdbase.viewrecords by naming the type (create({ type: "view", ... })). The view starter in mdbase.view 1.0.0 pinnedtype: { const: view }, requiredtype, and closed its top level. In collections whosesettings.explicit_type_keysis[mdbase_type](used becausetypeholds CSL data), every new view failed withschema_required: type/schema_additional_properties: mdbase_type.mdbase-contracts #14 (7d3d31e) published mdbase.view 1.0.1. It ships the version-2 starter, which has no pinned
typeand accepts unknown top-level fields, withupgrade_fromset to the unmodified 1.0.0 starter.What
apps/reader/mdbase/packs/mdbase.view-1.0.0.jsonwith the publisheddist/packs/mdbase.view/1.0.1.json, copied byte-for-byte, and pointsreader-manifest.mjsat the new file.public/.well-known/mdbase-app.json,src/generated/mdbase-app.jsonand the extension'ssrc/generated/mdbase-app.jsonwith the repo scripts underMDBASE_ENV=production.project_urlandhomepageare stillhttps://reader.mdbase.dev/.mdbase.view@1.0.0,sha256:0918acef…), sorequirements.contractsdoes not change. Only the pack version and the starter change.verify-manifest.mjsalready sends every pack throughreferenceInstallerProvision(), so the view seed'supgrade_fromis stripped for the JS installer the same way as for Reader's own pack.reader-type-pack.test.mjs:mdbase.view@1.0.0.sha256:b32222bc…, which matchesdesired.digestfrommdbase packs assess.mdbase.viewcontract under both[type]and[mdbase_type].Note:
@callumalpass/mdbase0.3.0-rc.5'screate()still requires the type's match rule (where: { type: view }) to hold, so it rejectscreate({ type: "view" })in a[mdbase_type]collection withmatch_failed. Connect's engine (mdbase CLI beta.123) accepts it. The new test therefore writes the record the way the engine records it and validates that record, instead of calling the JS SDK'screate.Verification
pnpm check(lint, typecheck, all unit tests) passed. apps/reader: node tests 18/18 and vitest 390/390. extension: 168/168. Packages: core 110, connect 123, renderer-pdf 65, migration 42, renderer-epub 32, web-capture 32, markdown-editor 28, reading-surface 21, renderer-html 16, platform 6, electron 2. Architecture: 11.MDBASE_ENV=production pnpm build(includesmanifest:validate) passed and left the tree clean.explicit_type_keys: [mdbase_type]:packs assess+packs applyof 1.0.1 worked. Thenmdbase create --type view(withtype: article-journalas data) returnedvalid: true, wrotemdbase_type: view, andmdbase validatereported no diagnostics.create --type viewfailed (schema_additional_properties: mdbase_type,schema_required: type).packs assessof 1.0.1 then returnedstatus: upgrade,_types/view.md: update, and the schema and contractunchanged. Afterapply,create --type viewwas valid andmdbase validatewas clean.