Repository navigation
feat(projection): export canonicalParamDefault from @adcp/sdk/v2/projection - #3868
Merged
Merged
Conversation
…ection canonicalParamDefault(kind, key) is the rule the SDK's v1_format_ref narrowing check uses (#3863): an omitted canonical-format parameter compares as the format's default, its schema default or the default every declaring canonical agrees on (asset_source -> buyer_uploaded on display_tag). It was internal, so a downstream readiness check kept comparing literally and flagging a real seller. Export it from @adcp/sdk/v2/projection with TSDoc (parameters, the { value } | undefined return, an example). Each call now returns a fresh copy, so a caller cannot mutate the memoized default. The adopter type-check guard imports it from the packed subpath. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Full local |
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
canonicalParamDefault(kind, key)is the rule the SDK's ownv1_format_refnarrowing check uses (#3863): an omitted canonical-format parameter compares as the format's default. That default is the parameter's schemadefault, or the default every canonical that declares it agrees on (asset_source→buyer_uploadedondisplay_tag). It was internal. A downstream platform's readiness check still compares literally, so it keeps flagging a real seller (IDM) in production.@adcp/sdk/v2/projection(CJS and ESM). It is not added to the package root, matching the other projection helpers.canonicalParamDefault(kind: string, key: string): { value: unknown } | undefined. The wrapper is kept so a default ofnull/falseis distinguishable from "no default".undefinedwhen no agreed default exists, or for an unknown kind) and an example comparison helper.structuredClone), so a caller mutating the result cannot corrupt the memoized default. The internal caller only reads.value.scripts/check-adopter-types.tsimports it from the packed@adcp/sdk/v2/projectionand type-checks the return type.scripts/audit-exports.jsonly covers the package root and has no snapshot, so it needs no change.Tests
test/lib/canonical-param-default-export.test.js: imports from@adcp/sdk/v2/projectionin CJS and ESM, checks parity with the internal rule, checksundefinedcases, and checks that a returned result can't mutate the cache.test/server-display-tag-asset-source-default.test.jspasses.npm run typecheck,npm run lint,npm run lint:boundaries,npm run format:check,npm run build:libandnpm run check:adopter-typesall pass. Fullnpm testresult is in a comment below.Changeset:
@adcp/sdkminor.🤖 Generated with Claude Code