Conversation
Diffbot extract endpoints declared host: api.diffbot.com but _normalize dropped it and _marketplace_upstream always joined provider.base_url (https://kg.diffbot.com/kg/v3) onto /v3/event, producing kg.diffbot.com/kg/v3/v3/event (nginx 404, $0). Keep hostname-only host on the catalog row and, when set, build https://{host} + path. Co-authored-by: SToneX <shitianxin@gmail.com>
Co-authored-by: SToneX <shitianxin@gmail.com>
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.
What this does
Catalog
host:was a dead field. Diffbot extract endpoints (feedback #178) declaredhost: api.diffbot.comand documentedhttps://api.diffbot.com/v3/event, but live/call/diffbot.x.extract-eventwent tohttps://kg.diffbot.com/kg/v3/v3/event(wrong host + doubled/v3), got nginx 404, and charged $0.Root cause, verified in code:
base_urlishttps://kg.diffbot.com/kg/v3._marketplace_upstreamalways builtprovider.base_url + pathand never readep['host']._normalizedroppedhostentirely, so even a later reader of the loaded catalog could not see it.This PR makes
host:real:_normalizekeeps a hostname-onlyhost(scheme/path/port rejected).hostis set,_marketplace_upstreambuildshttps://{host}+ path and does not prependprovider.base_url's path (/kg/v3).hostare unchanged (provider.base_url+ path).host:is notextra_tools.host:rewrites one catalog-id call's netloc while the same credential is injected.extra_tools(GA'sgoogle-analytics-admin) still creates a second Tool row for URL-passthrough / named-tool resolution. They coexist; this PR does not move Diffbot ontoextra_tools.Please review before merge. Do not deploy from this PR.
Blast radius
Any catalog endpoint that already declares
host:will now resolve to that host instead ofprovider.base_url. That is the intended fix. 117 loaded rows currently carryhost::src/treg/catalog/diffbot.extended.yaml- Extract / Crawl / Bulk / account onapi.diffbot.com; web-search onllm.diffbot.com; NL onnl.diffbot.com.src/treg/catalog/google-analytics.extended.yaml- Admin API rows onanalyticsadmin.googleapis.com(Data API rows stay onanalyticsdata.googleapis.com).src/treg/catalog/google-business-profile.extended.yaml- sibling My Business hosts (mybusinessbusinessinformation,qanda,placeactions,verifications,notifications,businessprofileperformance, legacymybusiness.googleapis.com).A catalog-id call to those rows previously hit the provider
base_urlhost (wrong). After this change they hit the declared host. GAextra_toolsnamed-tool / URL-passthrough paths are unchanged.Out of scope: feedback #179 /
connect --provider, settlement/billing/refund, Diffbotextra_toolsrefactor.Fragments updated:
architecture/catalog.md,architecture/proxy-model.md,architecture/auth-secrets.md.How it was tested
New unit tests in
tests/test_marketplace_call.py:diffbot.x.extract-event/extract-articleresolve tohttps://api.diffbot.com/v3/...and never/kg/v3/v3/.diffbot.companies.enrich(nohost) still useshttps://kg.diffbot.com/kg/v3/enhance.analyticsadmin.googleapis.com, not the Data API host._normalizekeeps a hostname and rejects scheme/path/port.Also
tests/test_catalog_validate.pyfor the hostname-onlyhost:contract.Ran locally:
uv run --frozen python -m pytest -q tests/test_marketplace_call.py tests/test_catalog_validate.py tests/test_catalog_api.py- 413 passeduv run --frozen python scripts/catalog_validate.py diffbot google-analytics google-business-profile- OK_marketplace_upstream; each origin ishttps://{host}and none contain/kg/v3/v3/uv run lint-imports- 14 contracts keptChecklist
uv run --with pytest-xdist pytest -n auto -qpasses locally (full suite not run here; targeted files above are green)docs/context/fragment (if a subsystem changed).envvalues)