feat(metadata): metadata-service registrations carry package provenance#1776
Merged
Conversation
The metadata-service sync path (loadMetadataFromService) and MetadataFacade.register called registry.registerItem without the 4th packageId param, so applyProtection never stamped _packageId / _provenance on synced items — GET /api/v1/meta/:type consumers (objectui NavigationSyncEffect, objectui PR #1668) could not tell package-shipped code-defined metadata from user-authored rows and fell back to the sys_ name-prefix heuristic, misclassifying third-party plugin pages. Fix: pass through each item's own _packageId (stamped upstream by the metadata plugin's artifact loader). Never synthesize an id like 'metadata-service' — isArtifactBacked() keys two-tier write authorization (allowOrgOverride vs allowRuntimeCreate) off a truthy _packageId, so a fake id would flip authorization for runtime-authored items. The nearby bindHooks packageId is an unbind-grouping label, not provenance. Deliberately unchanged: protocol.ts DB-hydration registerItem calls (loadMetaFromDb / getMetaItems hydration / overlay-delete refill) stay bare-key — ADR-0005 overlay precedence relies on the bare runtime row shadowing the composite pkg:name artifact entry. Also closes the filesystem-scanner gap: new MetadataPluginOptions .packageId (the project's defineStack manifest id) lets hand-wired kernels stamp scanned source-file metadata via the same applyProtection call the artifact path uses. Unset → unchanged behavior; the option is never guessed from package.json (npm name ≠ manifest id, and the value feeds write authorization). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Metadata registered through the metadata-service path had no provenance flags:
loadMetadataFromService(objectql/src/plugin.ts) andMetadataFacade.registercalledregistry.registerItem(type, item, keyField)without the 4thpackageIdparam, soapplyProtectionnever stamped_packageId/_provenance.GET /api/v1/meta/:typeconsumers (objectuiNavigationSyncEffect, objectui PR #1668) could not tell package-shipped code-defined metadata from user-authored rows and fell back to thesys_name-prefix heuristic — third-party plugin pages were misclassified as user-created.Changes
packages/objectql/src/plugin.ts(loadMetadataFromService) andpackages/objectql/src/metadata-facade.ts(register): pass through each item's own_packageId(stamped upstream by the metadata plugin's artifact loader). Never a synthetic id like'metadata-service'—isArtifactBacked()keys the two-tier write authorization (allowOrgOverridevsallowRuntimeCreate) off a truthy_packageId; a fake id would flip authorization for runtime-authored items. (The nearbybindHookspackageId: 'metadata-service'is an unbind-grouping label, not provenance.)packages/metadata/src/plugin.ts: newMetadataPluginOptions.packageId— hosts running the filesystem scanner (eager mode, noartifactSource) can declare the owning package id (the project'sdefineStackmanifest id);_loadFromFileSystemthen stamps scanned items via the sameapplyProtectioncall the artifact path uses. Unset → behavior unchanged. Deliberately not auto-derived frompackage.json(npm name ≠ manifest id, and the value feeds write authorization).pkg:nameregistry key as the engine manifest path, deduplicating the previous bare+composite double entries.Deliberately unchanged: the
protocol.tsDB-hydrationregisterItemcalls (loadMetaFromDb,getMetaItemshydration, overlay-delete refill) stay bare-key — ADR-0005 overlay precedence relies on the bare runtime row shadowing the composite package artifact entry.Testing
packages/objectql/src/metadata-facade.test.ts(passthrough / no synthetic stamping).plugin.integration.test.ts: metadata-service sync preserves the stamped/unstamped distinction.protocol-meta.test.ts:getMetaItemsserves_packageId/_provenancefor package-registered items, leaves user items clean.packages/metadata/src/plugin.test.ts: FS-scanner stamping with/without the option; pre-existing_packageIdnot overwritten.🤖 Generated with Claude Code