Repository navigation
docs: surface auto-hydration error contract + tighten idempotency principal types - #1126
Merged
Merged
Conversation
…ncipal types Adopter pre-ship feedback on v6.0 RC, three asks ranked by user. #1 (BLOCKER): Auto-hydration error contract surfaced in migration doc. Framework behavior on a hydration miss was documented in source JSDoc since the extension landed (from-platform.ts:2076-2135), but adopters reading the skill saw only the happy path. New "Auto- hydration error contract" block in migration-5.x-to-6.x.md walks the three possible meanings of a miss (cold start, eviction, unknown id), explains why the framework does NOT throw PRODUCT_NOT_FOUND / MEDIA_BUY_NOT_FOUND (cache is a hint, not source-of-truth), shows the handler-side existence-check pattern, and describes the __adcp_hydrated__ non-enumerable marker. #2 (polish): IdempotencyPrincipalParams.account / .brand now use canonical AccountReference / BrandReference wire types instead of the inline-typed flat shape. Adopters overriding the default to scope by account_id or brand.domain (the public-token-shared- across-tenants pattern) get autocomplete + narrowing on both variants of the discriminated union. JSDoc updated with the recommended `if ('account_id' in params.account)` pattern. #3 (docs): Migration doc consolidation verified. The cumulative breaking-changes table at the top of migration-5.x-to-6.x.md already covers all five round-by-round breaking changes with one-liner search-replace recipes — no edits needed. 267/267 server-side tests pass. format:check clean. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…s-link Two surgical follow-ups to the dx-expert review of PR #1126: 1. Migration-doc handler-side existence-check example used `MediaBuyNotFoundError` without showing the import. Adopters copy-pasting got `Cannot find name`. Added the import line and pointed at the typed-error class catalog (`@adcp/sdk/server/ decisioning/errors-typed`) so adopters reach for the typed classes (which auto-map to wire error codes with `recovery: 'terminal'`) instead of bare `AdcpError`. 2. `skills/build-seller-agent/SKILL.md:81` mentioned auto-hydration in one sentence with no error contract. Added a one-line blockquote pointer to the new "Auto-hydration error contract" section in the migration doc — adopters reading the seller skill first now find the contract on the path they actually take, not buried in source JSDoc. `build-decisioning-platform/SKILL.md` already had the contract inline at lines 99-109 (CONTRACT comment block) — verified, no edits needed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
4 of 5 tasks
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
Pre-ship cleanup driven by an adopter ranking three asks against the v6.0 RC. #1 was the only blocker — the auto-hydration contract on missing references multiplies across four mutating verbs but only the happy path was in adopter-facing docs. #2 was a polish carry-over from round 12. #3 was a docs question already addressed.
What changed
#1 (BLOCKER) — Auto-hydration error contract surfaced in the migration doc
Framework behavior on a hydration miss has been documented in source JSDoc since the auto-hydration extension landed (
from-platform.ts:2076-2135), but adopters reading the skill see only the happy path. The user listed three options the changeset should spell out:Actual behavior is #2 (silent miss, handler authoritative), with thoughtful rationale: a miss can mean cold start, cache eviction, OR a truly unknown id; the framework can't distinguish without consulting the publisher's DB, which is what the handler already does. Erroring at the framework would force every adopter to manage cache warmth before serving traffic — wrong default for a hint cache.
New "Auto-hydration error contract" block in
docs/migration-5.x-to-6.x.mdcovers:__adcp_hydrated__non-enumerable marker for disambiguation#2 (polish) —
IdempotencyPrincipalParams.account/.brandnow use canonical wire typesWas inline-typed as a flat shape with everything optional. Adopters overriding the default
resolveIdempotencyPrincipalto scope byparams.account?.account_id(public-token-shared-across-tenants pattern) had to live with the loose shape. Replaced withAccountReference/BrandReferencefrom the generated wire types so the discriminated union is exposed end-to-end. JSDoc updated with the recommendedif ('account_id' in params.account)pattern.#3 (docs) — Migration doc consolidation verified
The cumulative breaking-changes table at
docs/migration-5.x-to-6.x.md:22-28already covers all five round-by-round breaking changes with one-liner search-replace recipes (Account.metadatarename, server-subpath consolidation,createAdcpServerremoval,TMeta→TCtxMeta,getMediaBuysrequired). No edits needed.Why land before the v6.0.0 release-PR (#1085)
#1085 is open and unmerged. Landing this on
maincauses the changesets bot to rebase #1085 with the new docs + tighter type baked into 6.0.0 directly. Adopters install clean. No 6.0.1 needed for these asks.Test plan
npm run buildcleannpm run format:checkcleanIdempotencyPrincipalParamstypecheck against AccountReference/BrandReference passesRelated
🤖 Generated with Claude Code