feat(testing): version-staleness suffix on shape-drift hints (#850)#1030
Merged
feat(testing): version-staleness suffix on shape-drift hints (#850)#1030
Conversation
) When detectShapeDriftHints fires and the agent self-reported a library_version in get_adcp_capabilities that predates the recommended helper, the hint message is now suffixed with an upgrade note so developers know to bump their SDK dep rather than hunt for a missing import. - AgentProfile.library_version: populated from get_adcp_capabilities response - createAdcpServer: stamps library_version in capabilities so agents built on this SDK surface the version automatically - detectShapeDriftHints: optional third param threads library_version; semver comparison uses segment-by-segment parseInt (guards lexicographic sort bug) - HELPER_MIN_VERSION map tracks first-ship version for each hint-referenced helper - 6 new tests covering absent/above/below minimum and the 5.9.0 < 5.14.0 case https://claude.ai/code/session_01GePNjMP1gsdCwndoBMKhHJ
- Remove dead HELPER_MIN_VERSION entries for audioAsset/displayRender/parameterizedRender — none are referenced in any hint message, so the suffix would never fire - Strip pre-release suffix in semverLessThan so 5.14.0-beta.1 is treated correctly rather than silently missing the version comparison - Guard appendVersionSuffix against non-numeric library_version strings (e.g. "local-dev") to prevent spurious upgrade suffixes - Strengthen list-tool test assertion to check the specific helper name in suffix https://claude.ai/code/session_01GePNjMP1gsdCwndoBMKhHJ
After rebasing onto main, three issues surfaced from the merged work: 1. Prettier formatting on src/lib/testing/storyboard/runner.ts (the original CI failure — main's prettier config tightened slightly). 2. TypeScript noUncheckedIndexedAccess flagged the destructured semver segments in shape-drift-hints.ts:semverLessThan as possibly undefined. Defaulted aMaj/aMin/aPatch and bMaj/bMin/bPatch to 0 in the destructuring; semantically equivalent (parseInt(s, 10) || 0 already ran on every present segment) but satisfies strict indexing. 3. The original PR referenced `profile?.library_version` inside executeStep but `profile` is only in scope at runStoryboard's caller level. Threaded `agentLibraryVersion` through ExecutionState so executeStep reads it from runState. Both call sites (runStoryboard's per-step loop + runStoryboardStep's standalone path) now populate the field from the discovered profile. 4. The capabilitiesData cast at create-adcp-server.ts:2996 needed an intermediate `as unknown` per main's stricter type rules, since GetAdCPCapabilitiesResponse and Record<string, unknown> don't structurally overlap. Behavior unchanged — same hand-stamp of library_version onto the response object as a forward-compatible extension. All targeted tests still pass (21 in shape-drift-hints + version-staleness suite, 133 in controller-related tests).
67c4695 to
1902876
Compare
Contributor
Author
|
Took this over: rebased onto main and fixed the four breakages (one was the original CI failure, three surfaced from rebasing onto today's merges). What I did:
Tests: all targeted suites pass (21 shape-drift / version-staleness + 133 controller). PR is now marked ready. Watching CI. |
Contributor
Author
|
Thanks for taking this over, @bokelley — the rebase + the four fixes (prettier, strict indexing defaults, Generated by Claude Code |
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.
Closes #850
When a storyboard drift hint recommends a server-side helper (e.g.
buildCreativeResponse()) and the agent self-reported alibrary_versioninget_adcp_capabilitiesthat predates the helper's minimum SDK release, the hint message is now suffixed:"Note: your agent reports @adcp/client@4.16.2 — buildCreativeResponse() ships in @adcp/client ≥5.14.0. Upgrade your SDK dep."Agents that don't emitlibrary_versionare unaffected.createAdcpServernow stampslibrary_versionin the capabilities response automatically, so agents built on this SDK surface the version without any adopter changes.Changes:
AgentProfile.library_version?: string— populated fromget_adcp_capabilitiesresponse indiscoverAgentProfile()createAdcpServer— stampslibrary_version: "@adcp/client@X.Y.Z"as a forward-compat extension field (schema uses.passthrough()so no AJV rejection risk; comment notes this should migrate toext.library_versionwhen the spec formally defines it)detectShapeDriftHints()— optional third paramlibraryVersion;HELPER_MIN_VERSIONmap; numeric semver comparison with pre-release strip and non-numeric guard5.9.0 < 5.14.0case that guards against lexicographic sort bugsNits surfaced from pre-PR review (not fixed — low priority):
hint.message = appendVersionSuffix(...)mutates the fresh hint object in place;{ ...hint, message }would be more consistent with the file's immutable stylelibrary_versionwire format is npm-scoped (@adcp/client@5.20.0); if a future AdCP minor formalizes the field, bare semver + separatelibrary_namewill be easier to schema-defineHELPER_MIN_VERSIONneeds updating alongside new server helpers; a test asserting everyLIST_WRAPPER_TOOLSkey has a corresponding entry would prevent silent driftWhat was tested:
tsc --project tsconfig.lib.json --noEmitOnError false— zero new errors (2 pre-existing config warnings: deprecatedmoduleResolution=node10, missing@types/node)node --test test/lib/storyboard-shape-drift-hints.test.js— 19/19 passPre-PR review:
HELPER_MIN_VERSIONentries removed, pre-release semver strip added) — nits noted above.passthrough()so extension field is safe; nit on wire format convention noted aboveSession: https://claude.ai/code/session_01GePNjMP1gsdCwndoBMKhHJ
Generated by Claude Code