fix(comply): autodetect webhook_receiver requirement from token presence#1690
Merged
Merged
Conversation
…nce (#1678) Storyboards that reference `{{runner.webhook_url:<step_id>}}` or `{{runner.webhook_base}}` in `sample_request` need a webhook receiver. Previously, when no receiver was configured, the expander returned the literal mustache token as the URL — 3.0-strict sellers (Wonderstruck- class) reject the resulting payload as `INVALID_REQUEST: relative URL`, cascading 5 first-step failures across `webhook_emission/*` and `idempotency/replay_same_payload`. The fix: - Extend `RequirementName` with `'webhook_receiver'`; add to `KNOWN_REQUIREMENTS`. - Map `'webhook_receiver' → 'requirement_unmet'` in `REQUIREMENT_TO_SKIP_REASON`. - Extend `checkRequires()` to detect `options.webhook_receiver === undefined`. - Add `detectImplicitRequires(storyboard)` that scans every step's `sample_request` recursively for the webhook tokens and returns `['webhook_receiver']` when found. Token presence IS the declaration — authors do not need to add `requires: [webhook_receiver]` manually. - Union declared and implicit requirements before the gate check. Matches spec contract at compliance/{version}/universal/webhook- emission.yaml L34, L62-70, L331-332 ("Runners without a receiver grade this universal as not_applicable"). Part of the coordinated stance at #1685 (the SDK is a witness, not a translator). Hat 3 of 5. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 11, 2026
Contributor
Author
|
Acknowledged — merge order noted: #1684 first, then #1682, then this PR. No code changes needed; the dependency is a sequencing constraint, not a diff issue. 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 #1678. Part of the coordinated stance at #1685.
Summary
comply()was shipping the literal mustache token{{runner.webhook_url:<step_id>}}on the wire whenever a webhook-emitting storyboard ran without a configured receiver. 3.0-strict sellers (Wonderstruck) correctly reject the resulting payload asINVALID_REQUEST: Input should be a valid URL, relative URL without a base, cascading 5 distinct first-step failures acrosswebhook_emission/*andidempotency/replay_same_payload.The spec already answers what should happen:
compliance/{version}/universal/webhook-emission.yamlL34: "grades not_applicable when the runner does not host a webhook receiver"So the SDK's job is to grade
not_applicable, not to placeholder a fake URL. The triage thread on #1678 considered synthesizinghttps://aao.test/sink/...and rejected it — that would letsignature_validityvacuously pass against a sink that never responds, which is exactly the false-certification failure mode #1685 is rejecting.What changed
RequirementName— extended with'webhook_receiver'; added toKNOWN_REQUIREMENTS.REQUIREMENT_TO_SKIP_REASON— maps'webhook_receiver' → 'requirement_unmet'.checkRequires()— detectsoptions.webhook_receiver === undefinedand returns a structured unmet requirement with a helpful detail message.detectImplicitRequires(storyboard)— new helper that recursively scans every step'ssample_requestfor{{runner.webhook_url:<step_id>}}or{{runner.webhook_base}}tokens and returns['webhook_receiver']when any are found. Token presence IS the declaration.storyboard.requires) and implicit requirements before callingcheckRequires.Why autodetection, not a
requires:retagThe triage thread proposed two options:
signature_validityvacuously pass against a sink that never responds. False certification claim.RequirementNamewith'webhook_receiver'and tag storyboards): correct, but requires every webhook storyboard YAML inadcontextprotocol/adcpto be retagged AND new ones to remember the tag.This PR takes the third path: option 2's runtime, with autodetection driving the requirement. Authors don't write
requires: [webhook_receiver]— the existing{{runner.webhook_url:…}}token in theirsample_requestalready declares the dependency. New webhook scenarios inherit the gate automatically.The loader still accepts an explicit
requires: [webhook_receiver](the new test confirms this) for authors who want belt-and-suspenders, but no spec change is required.What was tested
test/lib/storyboard-requires-gate.test.js:{{runner.webhook_url:…}}tokens trigger the gate (no receiver →requirement_unmet:webhook_receiver){{runner.webhook_base}}tokens trigger the gaterequires: [webhook_receiver]npx tsc --noEmit --project tsconfig.lib.json— clean.npx prettier --check— clean.Coordination
Merge order (#1685):
adcp_errorforwarding) — ships first, makes wire-level errors observableaccount_from_brandremoval) and fix(normalizer): fail closed on pre-3.0 PackageRequest shapes #1681 (1677 — package normalizer fail-closed) — fabrication twinsnot_applicablerouting for missingrequired_tools)webhook_receiver. Lands last; logically depends on fix(conformance): grade storyboards not_applicable when required_tools are missing #1682'snot_applicableplumbing for grader-side surfacing.🤖 Generated with Claude Code