From f4cf76bbe54eff3bd52bdc51b713c94fb23a668a Mon Sep 17 00:00:00 2001 From: Daniel Yudelevich Date: Thu, 5 Nov 2026 11:32:54 -0800 Subject: [PATCH 1/2] feat(sdk): drop language from ExtractResult The API removes the field from /extract, so the contract check would flag it once that release is live. Merge after the platform release. --- .../discolike-cli/src/discolike_cli/_help.py | 2 +- packages/discolike-cli/tests/test_company.py | 6 +++--- .../src/discolike/resources/companies.py | 1 - packages/discolike/tests/test_companies.py | 3 +-- .../discolike/tests/test_contract_registry.py | 18 ++++++------------ 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/packages/discolike-cli/src/discolike_cli/_help.py b/packages/discolike-cli/src/discolike_cli/_help.py index ab894b7..dde4b27 100644 --- a/packages/discolike-cli/src/discolike_cli/_help.py +++ b/packages/discolike-cli/src/discolike_cli/_help.py @@ -185,7 +185,7 @@ def format_help(self, ctx: Context, formatter: HelpFormatter) -> None: """, "extract": """\ Output (success, exit 0): - {"text": , "language": } + {"text": } Fetches the page live; use it to confirm a seed domain is the right company. Common errors: diff --git a/packages/discolike-cli/tests/test_company.py b/packages/discolike-cli/tests/test_company.py index 3b51b18..f43b7d1 100644 --- a/packages/discolike-cli/tests/test_company.py +++ b/packages/discolike-cli/tests/test_company.py @@ -135,7 +135,7 @@ def test_extract_hits_extract_endpoint_with_url(install_build_client: Callable[[ def handler(request: httpx2.Request) -> httpx2.Response: captured["request"] = request - return httpx2.Response(200, json={"text": "hello", "language": "en"}) + return httpx2.Response(200, json={"text": "hello"}) install_build_client(handler) result = runner.invoke(app, ["extract", "https://acme.com/about"]) @@ -143,7 +143,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: request = captured["request"] assert request.url.path == "/v1/extract" assert request.url.params.get("url") == "https://acme.com/about" - assert json.loads(result.stdout) == {"text": "hello", "language": "en"} + assert json.loads(result.stdout) == {"text": "hello"} def test_extract_domain_option_replaces_url(install_build_client: Callable[[Handler], None]) -> None: @@ -151,7 +151,7 @@ def test_extract_domain_option_replaces_url(install_build_client: Callable[[Hand def handler(request: httpx2.Request) -> httpx2.Response: captured["request"] = request - return httpx2.Response(200, json={"text": "hello", "language": "en"}) + return httpx2.Response(200, json={"text": "hello"}) install_build_client(handler) result = runner.invoke(app, ["extract", "--domain", "acme.com"]) diff --git a/packages/discolike/src/discolike/resources/companies.py b/packages/discolike/src/discolike/resources/companies.py index 4f1cc91..81c5307 100644 --- a/packages/discolike/src/discolike/resources/companies.py +++ b/packages/discolike/src/discolike/resources/companies.py @@ -87,7 +87,6 @@ class Growth(DiscolikeModel): class ExtractResult(DiscolikeModel): text: str | None = None - language: str | None = None class Redirect(DiscolikeModel): diff --git a/packages/discolike/tests/test_companies.py b/packages/discolike/tests/test_companies.py index d4cc769..246d4b8 100644 --- a/packages/discolike/tests/test_companies.py +++ b/packages/discolike/tests/test_companies.py @@ -97,13 +97,12 @@ def handler(request: httpx2.Request) -> httpx2.Response: def test_extract_parses_text_and_language(make_client: ClientFactory) -> None: def handler(request: httpx2.Request) -> httpx2.Response: - return httpx2.Response(200, json={"language": "en", "text": "Acme makes widgets."}) + return httpx2.Response(200, json={"text": "Acme makes widgets."}) with make_client(handler) as client: result = client.companies.extract(CompaniesExtractParams(domain="acme.com")) assert result.text == "Acme makes widgets." - assert result.language == "en" def test_unset_match_mode_is_not_sent(make_client: ClientFactory) -> None: diff --git a/packages/discolike/tests/test_contract_registry.py b/packages/discolike/tests/test_contract_registry.py index ecde573..f8c8c6c 100644 --- a/packages/discolike/tests/test_contract_registry.py +++ b/packages/discolike/tests/test_contract_registry.py @@ -66,7 +66,7 @@ def test_check_models_passes_when_spec_matches_model(): check_contract = _load_check_contract() from discolike.resources.companies import ExtractResult - spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}, "language": {}}}}}} + spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}}}}}} assert check_contract.check_models(spec, {"ExtractResponse": ExtractResult}) == [] @@ -74,16 +74,16 @@ def test_check_models_reports_field_the_spec_does_not_have(): check_contract = _load_check_contract() from discolike.resources.companies import ExtractResult - spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}}}}}} + spec = {"components": {"schemas": {"ExtractResponse": {"properties": {}}}}} mismatches = check_contract.check_models(spec, {"ExtractResponse": ExtractResult}) - assert mismatches == ["ExtractResult: field 'language' not in spec schema 'ExtractResponse'"] + assert mismatches == ["ExtractResult: field 'text' not in spec schema 'ExtractResponse'"] def test_check_models_reports_field_the_sdk_does_not_declare(): check_contract = _load_check_contract() from discolike.resources.companies import ExtractResult - spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}, "language": {}, "summary": {}}}}}} + spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}, "summary": {}}}}}} mismatches = check_contract.check_models(spec, {"ExtractResponse": ExtractResult}) assert mismatches == ["ExtractResult: spec schema 'ExtractResponse' has field 'summary' the SDK does not declare"] @@ -92,7 +92,7 @@ def test_check_models_ignores_type_and_requiredness_when_spec_gives_no_type_info check_contract = _load_check_contract() from discolike.resources.companies import ExtractResult - spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}, "language": {}}}}}} + spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {}}}}}} assert check_contract.check_models(spec, {"ExtractResponse": ExtractResult}) == [] @@ -143,7 +143,6 @@ def test_check_models_passes_a_nullable_field_expressed_via_anyof(): "ExtractResponse": { "properties": { "text": {"anyOf": [{"type": "string"}, {"type": "null"}]}, - "language": {"anyOf": [{"type": "string"}, {"type": "null"}]}, }, } } @@ -162,7 +161,6 @@ def test_check_models_passes_a_nullable_field_expressed_via_openapi_nullable_fla "ExtractResponse": { "properties": { "text": {"type": "string", "nullable": True}, - "language": {"type": "string", "nullable": True}, }, } } @@ -185,11 +183,7 @@ def test_check_models_accepts_an_sdk_field_nullable_where_the_spec_is_not(): check_contract = _load_check_contract() from discolike.resources.companies import ExtractResult - spec = { - "components": { - "schemas": {"ExtractResponse": {"properties": {"text": {"type": "string"}, "language": {"type": "string"}}}} - } - } + spec = {"components": {"schemas": {"ExtractResponse": {"properties": {"text": {"type": "string"}}}}}} assert check_contract.check_models(spec, {"ExtractResponse": ExtractResult}) == [] From ccaf3499e5ca12eae600cad1a8eda4423487c495 Mon Sep 17 00:00:00 2001 From: Daniel Yudelevich Date: Thu, 5 Nov 2026 11:33:22 -0800 Subject: [PATCH 2/2] docs(changelog): note ExtractResult language removal --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de9e3a0..db36345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- SDK/CLI: `ExtractResult` drops `language`; the API no longer returns it from `/extract`. + ## 0.6.2 (2026-10-21) - SDK/CLI: Python 3.15 is supported and tested in CI.