Skip to content

chore: release package - #58

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
changeset-release/main
Closed

github-actions[bot] wants to merge 1 commit into
mainfrom
changeset-release/main

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@adcp/[email protected]

Minor Changes

  • 329ce6e: Add Zod schema exports for runtime validation with automatic generation

    This release adds Zod schema exports alongside existing TypeScript types, enabling runtime validation of AdCP data structures. All core schemas, request schemas, and response schemas are now available as Zod schemas.

    New exports:

    • Core schemas: MediaBuySchema, ProductSchema, CreativeAssetSchema, TargetingSchema
    • Request schemas: GetProductsRequestSchema, CreateMediaBuyRequestSchema, SyncCreativesRequestSchema, etc.
    • Response schemas: GetProductsResponseSchema, CreateMediaBuyResponseSchema, SyncCreativesResponseSchema, etc.

    Features:

    • Runtime validation with detailed error messages
    • Type inference from schemas
    • Integration with React Hook Form, Formik, etc.
    • OpenAPI generation support via zod-to-openapi
    • Automatic generation: Zod schemas now generated automatically when running npm run generate-types
    • CI integration: Pre-push hooks and CI checks ensure schemas stay in sync

    Automatic workflow:

    # Sync latest AdCP schemas and generate all types (TypeScript + Zod)
    npm run sync-schemas && npm run generate-types

    Usage:

    import { MediaBuySchema } from "@adcp/client";
    
    const result = MediaBuySchema.safeParse(data);
    if (result.success) {
      console.log("Valid!", result.data);
    }

    Documentation:

    • docs/ZOD-SCHEMAS.md - Complete usage guide with NPM distribution details
    • docs/VALIDATION_WORKFLOW.md - CI integration (existing)
    • examples/zod-validation-example.ts - Working examples

@bokelley

Copy link
Copy Markdown
Contributor

Closing to combine with creative testing improvements. Will create new Release PR after merging PR #56.

@bokelley bokelley closed this Oct 20, 2025
bokelley added a commit that referenced this pull request Jun 30, 2026
…per 1/2: code) (#2263)

* feat(storyboard): add expect_universal_macro_substituted assertion task

Introduce StoryboardStep fields (source, source_path, macro_template,
macro_bindings) and the no_preview_surface detailed skip reason to
support the new pseudo-task. The handler reads rendered HTML from a
prior step's parsed response body via a JSON Pointer, runs
SubstitutionObserver.parse_html + match_bindings, and asserts each
configured macro binding was substituted with the correct context value.
Absence of a preview surface is a neutral skip (not_applicable), not a
conformance failure.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* feat(storyboard): wire expect_universal_macro_substituted into the runner dispatch

Import and dispatch the new handler after the webhook-assertion branch in
executeStep. Export UNIVERSAL_MACRO_ASSERTION_TASKS and
executeUniversalMacroAssertionStep from the storyboard index so callers
can identify and invoke the task independently.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* test(storyboard): allow expect_universal_macro_substituted in completeness check

Add the new task name to the HARNESS_TASKS allowlist so the structural
completeness test does not flag it as a missing-schema task when it
appears in storyboard YAML files.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(substitution): stop dropping multi-param tracker URLs in residual-entity check

The residual-entity check used RESIDUAL_ENTITY_RE with an optional
trailing semicolon on the named-entity branch, so a literal query
separator like ?mb=1&pkg=2 (after &amp; decoding) matched on &pkg and
the whole URL was dropped as a smuggled entity. Browsers render &pkg
literally, so this was a false positive.

Require a trailing semicolon for the NAMED branch (browsers only decode
a fixed legacy no-semicolon set, none of which are the dangerous
URL-scheme chars : / \, which need a semicolon: &colon; &sol; &bsol;).
Keep the NUMERIC branch matching with an optional semicolon, since
browsers decode &#58 / &#x3a leniently and query keys never start with #.

Export __hasResidualEntity for direct unit testing.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* test(storyboard): cover multi-param tracker URL in identifier-substitution assertion

Add two tests that exercise the canonical real-world case where both
{MEDIA_BUY_ID} and {PACKAGE_ID} appear in a single tracker URL with
&amp; HTML-encoding: a pass case (both macros correct) and a negative
case (pkg= wrong, mb= correct) verifying per-binding granularity.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(storyboard): harden path resolution and prior-step lookup in identifier assertion

- resolvePointer now guards against prototype chain traversal using
  POINTER_FORBIDDEN_KEYS and Object.prototype.hasOwnProperty.call, matching
  the discipline established in path.ts
- getLastPriorResult (renamed getPriorResult) now respects step.triggered_by
  when set, falling back to the last Map entry otherwise — mirrors the
  webhook-assertions.ts pattern
- Empty/absent macro_bindings now emits a failing ValidationResult explaining
  the misconfiguration instead of silently grading passed:false with zero validations
- __hasResidualEntity removed from the three package-level barrels
  (observer/index.ts, substitution/index.ts, src/lib/index.ts); tests that
  need it import via the deep path dist/lib/substitution/observer/html-parser.js

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* feat(substitution): add universal_macro_translation seller helper

Implements a query-parameter macro translator that accepts a
MacroMapping (native raw or RFC 3986 value) and returns the translated
URL with dropped_params/unmapped_macros metadata.  Reuses encodeUnreserved
from rfc3986.ts so produce and verify share one encoding path.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* refactor(substitution): dedupe macro pattern and document translate result shape

Reuse the module-level UNIVERSAL_MACRO constant in the replace() call instead
of inlining a duplicate literal; fix the misleading comment to accurately
describe String.replace single-pass semantics; expand TranslateResult doc
comments to note the dropped_params/unmapped_macros asymmetry; add tests for
macro tokens in key position (pass-through) and non-ASCII UTF-8 encoding.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore: changeset for universal-macro substitution assertion + helper

* style: prettier format new substitution/storyboard files

* fix(deps): bump undici to 6.27.0 to resolve high-severity advisories

Resolves the high-severity undici advisories (GHSA-p88m-4jfj-68fv,
GHSA-vxpw-j846-p89q, GHSA-35p6-xmwp-9g52, GHSA-g8m3-5g58-fq7m) flagged by
the Security Audit CI lane. 6.27.0 is within the existing ^6.25.0 range.
npm audit --audit-level=high now passes.

* refactor(substitution): scope PR to translation helper + parser fix

Per maintainer review (#2263), pull the expect_universal_macro_substituted
assertion and its runner wiring: it observes a build_creative preview, but
{MEDIA_BUY_ID}/{PACKAGE_ID} resolve at serve time and aren't serialized on the
wire, so the check skip-dominates for conformant sellers. Deferred to the
forthcoming Live Integration (decisioning-roundtrip) check, where the alignment
logic is reusable.

Keep + polish the helper:
- rename universal_macro_translation -> translateUniversalMacros (camelCase, to
  match the substitution module's free-function convention)
- add suspect_native_values to flag value entries shaped like native ad-server
  tokens (%%..%%, {{..}}, ${..}, [..]) that were likely mapped to the wrong arm
- document the value-only scope and the dropped-consent-macro privacy hazard

The SubstitutionObserver residual-entity parser fix and undici bump are retained.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* refactor(substitution): polish translateUniversalMacros per review

- add dropped_consent_macros: surface dropped consent/privacy macros
  ({GDPR_CONSENT}, {US_PRIVACY}, …) separately from benign drops
- tighten NATIVE_TOKEN_SHAPE bracket arm to [UPPER_SNAKE] so ordinary
  bracketed values ([1,2,3], [redacted]) are no longer flagged suspect
- document that suspect_native_values is mapping-scoped (config-lint), and
  that a bare trailing '?' is dropped

Co-Authored-By: Claude Opus 4.8 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Co-authored-by: Brian O'Kelley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant