fix(comply): forward structured adcp_error from failed storyboard steps#1684
Conversation
…ps (#1679) Structured error detail (code, field, details.validation_errors) was silently dropped at the executeStoryboardTask boundary. ConversationTypes.TaskResultFailure carries adcpError but testing/types.ts TaskResult had no matching field, so every downstream consumer (runner, storyboard-tracks, comply extractFailures) saw only the human-readable error string. https://claude.ai/code/session_018694zhanVSMB72JRJEQCwq
…l import Pre-PR review (code-reviewer) noted that delete step.error in the peer_branch_taken regrade path was not matched by delete step.adcp_error, leaving inconsistent intermediate state on skipped StepResults. Also converts inline import() in compliance/types.ts to a top-level import type to match the file's header style. https://claude.ai/code/session_018694zhanVSMB72JRJEQCwq
|
Tracking under #1685 (the SDK is a witness, not a translator). This is the keystone PR — ship this first. While |
|
Acknowledged — keystone ordering noted. Holding #1683, #1681, #1682, and #1690 as observability-dependent on this merge. Generated by Claude Code |
|
Noted — thanks for the sequencing update. Once this merges, #1683, #1681, #1682, and #1690 should be clear to proceed. Generated by Claude Code |
|
Understood — noted the downstream unblock list (#1683, #1681, #1682, #1690). Nothing to act on here; this PR is ready for merge when you're set. Generated by Claude Code Generated by Claude Code |
|
Acknowledged — standing by for merge. Generated by Claude Code Generated by Claude Code |
…ible via ComplianceResult (#1698) * docs(AdcpErrorInfo): warn sellers that message/details are grader-visible `adcp_error.message` and `.details` from seller responses are forwarded into `ComplianceResult.failures[].adcp_error` (landed in PR #1684) — a grader-visible archive surface that outlives the request. Three touches: - JSDoc on `AdcpErrorInfo.message` and `.details` in ConversationTypes.ts with an explicit seller-side warning (grader-visible, don't embed tokens or internal IDs) - New subsection §4 "Compliance failure envelopes (`adcp_error`)" in `docs/guides/CTX-METADATA-SAFETY.md` covering what flows where, what to avoid, and cross-linking to pickSafeDetails - Two-sentence addition in `skills/build-decisioning-platform/advanced/ REFERENCE.md` pickSafeDetails section noting the compliance-record leak class alongside the live-buyer-response leak class Closes #1697 https://claude.ai/code/session_011YZtF1KAFTD54e85so2KjN * fix(docs): correct relative path in REFERENCE.md cross-link Three ../ hops not four from skills/build-decisioning-platform/advanced/ to repo root. https://claude.ai/code/session_011YZtF1KAFTD54e85so2KjN * fix: drop duplicate ValidationError import in request-normalizer The squash-merge of #1681 (`from '../errors/index'`) and #1683 (`from '../errors'`) into main produced two identical-name imports. TS2300 breaks the build on every PR branched off the post-merge main. Single import resolves both. * fix(test): pass account in pre-3.0 package shape tests After #1683 landed, `normalizeRequestParams('create_media_buy', …)` requires an explicit account. Add `account: { account_id: 'test-acc' }` to the two test fixtures so the package-shape validators (#1681) are still the gate under test. --------- Co-authored-by: Claude <noreply@anthropic.com>
Closes #1679
Summary
When a storyboard step fails with a structured AdCP error (e.g.
INVALID_REQUESTwithfield+details.validation_errors),ConversationTypes.TaskResultFailure.adcpErrorwas silently dropped at theexecuteStoryboardTaskboundary. Thetesting/types.ts TaskResulthad noadcpErrorfield, so every downstream consumer — the runner,storyboard-tracks.ts, andextractFailures()incomply.ts— only saw the human-readableerror: string. This leftComplianceFailure.erroras either an opaque string or{}, making AAO heartbeat grading and LLM self-correction loops unable to identify the exact fault address without re-running the step.This PR adds
adcp_error?: AdcpErrorInfoas a parallel field alongside the existingerror?: stringacross the full compliance pipeline:testing/types.ts TaskResult— new field wired at the roottask-map.ts executeStoryboardTask— forwardsresult.adcpErrorasadcp_errorstoryboard/types.ts StoryboardStepResult— new field propagated by the runnerrunner.tsstep result assembly — spreadstaskResult.adcp_error; suppressed onexpect_errorsteps (mirrors existingerrorsuppression); deleted onpeer_branch_takenregrade (consistency fix caught in pre-PR review)compliance/types.ts ComplianceFailure— new field on the primary machine-readable surfacecomply.ts extractFailures()— forwardsstep.adcp_errorinto assembled failuresAll changes are additive-only.
error?: stringis unchanged; callers reading it as a string will continue to work. The new field is optional and present only when the agent returned a structuredadcp_errorenvelope.What was tested
npm run format:check— passed ✓npm run typecheck— pre-existing errors (Cannot find type definition file for 'node', deprecatedmoduleResolution=node10); no new errors introduced (verified by stash+recheck)npm run build:lib— cannot run (nonode_modulesin CI sandbox)npm test— 5 new tests added intask-map.test.ts; 406 pre-existing test files fail due to missing packages (zod,ws,@modelcontextprotocol/sdk) in the no-npm-installsandbox; 2 unrelated test files continue to pass. New tests will pass withnpm install— the import chain (task-map → response-unwrapper → zod) is present in the pre-existing baseline failure list, not introduced by this change.Nits noted (not fixed — out of scope for this PR)
runner.ts:3307||short-circuit: ifstepResult.error(client-side throw) is non-empty,taskResult?.error(protocol string) is never read. Pre-existing; tracked separately.summary.ts deriveReasoncould preferadcp_error.code + adcp_error.fieldwhen the struct is present. Pre-existing; tracked separately.expect_errorsuppression design: both "suppress" (current) and "always include" are defensible. Current choice mirrors the existingerrorgate and avoids consumer confusion on passing steps. Documented inStoryboardStepResult.adcp_errorTSDoc.Pre-PR review
expect_errorsuppression sound, two issues fixed (peer_branch_taken regrade inconsistency, top-level import type in compliance/types.ts); nit on runner-level suppression test noted but cannot be added withoutnpm installenvironmentAdcpErrorInfois the canonical error shape,minorchangeset bump is correctSession: https://claude.ai/code/session_018694zhanVSMB72JRJEQCwq
Generated by Claude Code