feat(sdk): canonical builtin_object_type metadata builder and typed topic registration - #166
Merged
Merged
Conversation
ObjectTopicMetadataBuilder emits the canonical builtin_object_type discovery key via PJ::sdk::name(), with deterministic ordering, JSON escaping, and enum-only validation. Typed registerTopic / registerObjectTopic / registerObjectTopicOnDataset overloads forward to the existing raw metadata_json slots; no C-ABI change. Implemented by Codex session 019fd0fe-beb1-7d93-85c1-244943244efb. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Correct every doc that recommended object_type or implied media_class selects a renderer; document the canonical key at each registration surface; add the 0.21.0 changelog entry. Implemented by Codex session 019fd0fe-beb1-7d93-85c1-244943244efb. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
facontidavide
force-pushed
the
feat/object-topic-metadata
branch
from
August 6, 2026 10:29
2122435 to
3b4eddb
Compare
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.
Companion G2 of the dialog-tree / SDK-compatibility plan (SDK 0.21.0 train). Independent of #164; trivial CHANGELOG conflict expected with sibling PRs.
What
Three incompatible renderer-selection keys circulate today: docs recommended
{"object_type": ...},MediaMetadataBuilderemitsmedia_class, but the application discovers renderers ONLY viabuiltin_object_type(canonicalPJ::sdk::name()values, e.g."kImage"). Emitting the wrong key leaves an object topic silently invisible. This PR makesbuiltin_object_typethe one canonical key at the SDK level.ObjectTopicMetadataBuilder: acceptsBuiltinObjectTypeonly (never free-form strings); validates viaparse(name(type))round-trip (rejectskNone, reserved values, unknown casts); deterministic key order (canonical key first, then lexicographic); correct JSON escaping via a shareddetailescaper (MediaMetadataBuildernow reuses it — byte-for-byte output-equivalent to its old private helper).build()returnsExpected<std::string>— behavior does not degrade underNDEBUG. Typed registration on invalid metadata returns the error and never touches the vtable.SourceObjectWriteHostView/ toolbox views (registerTopic/registerObjectTopic/registerObjectTopicOnDatasetoverloads takingBuiltinObjectType), constrained so existingregisterTopic("x", {})calls keep binding the raw string overload (covered by a compile-time test). No C-ABI changes.media_classdoes not select a renderer.Verification
54/54 ctest, warnings-as-errors, pre-commit clean; independent adversarial review passed after fixes (release-mode validation,
{}overload compatibility, missed authoring doc); release-mode invalid-input tests included.🤖 Generated with Claude Code