Skip to content

@adcp/sdk per-tool get-reporting-status type makes OperationalFailure uninhabitable #7204

Description

@bokelley

Version

  • @adcp/sdk@14.0.0-beta.29
  • bundled AdCP schemas: 3.2.0-beta.11
  • TypeScript 5.9.2, strict: true, skipLibCheck: false
  • Node 24.14.1

Minimal reproduction

import type { GetReportingStatusResponse } from '@adcp/sdk/types/get-reporting-status'

const response: GetReportingStatusResponse = {
  status: 'failed',
  view: 'revision',
  failure_kind: 'operational',
  errors: [{ code: 'INTERNAL_ERROR', message: 'Temporarily unavailable.' }],
}

void response
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "skipLibCheck": false,
    "noEmit": true
  }
}

Running tsc reports:

error-type.ts(7,14): error TS2322: Type 'string' is not assignable to type '"NOT_FOUND"'.
error-type.ts(7,38): error TS2322: Type 'string' is not assignable to type '"Reporting status resource is unavailable."'.

The same operational-failure JSON is valid under the bundled media-buy/get-reporting-status-response.json schema.

Cause

The advertised self-contained per-tool declaration uses Error in the base response and in OperationalFailure (errors: Error[]) but does not declare or import the protocol Error type. TypeScript therefore resolves the JavaScript global Error. Intersecting the base response with FailedLookup makes the operational arm effectively uninhabitable and produces the misleading unavailable-lookup literal errors above.

UnavailableLookup does not exhibit the same problem because it inlines its exact error object.

Expected

The per-tool generator should emit the protocol error declaration (or inline the operational error shape), so a schema-valid OperationalFailure is assignable to GetReportingStatusResponse without a cast.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaude-triagedIssue has been triaged by the Claude Code triage routine. Remove to re-triage.priority:P1High priority: important bug or follow-up, not immediate P0schemaJSON Schema source-of-truth: definitions, codegen artifacts, validation, hygiene

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions