Skip to content

fix: allow copied clients to clear default headers and query - #92

Draft
Kayvan-Zahiri wants to merge 1 commit into
supermemoryai:mainfrom
Kayvan-Zahiri:codex/clear-copied-client-defaults
Draft

Kayvan-Zahiri wants to merge 1 commit into
supermemoryai:mainfrom
Kayvan-Zahiri:codex/clear-copied-client-defaults

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

Passing an empty mapping to copy(set_default_headers={}) or copy(set_default_query={}) currently retains the original defaults. The truthiness fallback treats {} like an omitted replacement. This also affects with_options() and both sync and async clients.

Use an explicit is not None check so an empty replacement clears the selected defaults. Ordinary default_headers / default_query overrides still merge, and None still preserves the inherited values. The change lives in the hand-maintained custom/supermemory/_compat.py; the checked-in src mirror is copied from that source using the same operation as scripts/apply_custom.py.

Added 24 HTTPX MockTransport regression cases exercising actual namespaces.list() requests through both clients and both copy methods. They cover empty/nonempty replacements, omitted replacements, merging, authentication preservation, and the unchanged original client. Twelve cases fail against the original code.

Validation:

  • All 63 offline tests pass with Pydantic 2 and separately with Pydantic 1 (pytest --ignore=tests/live -q). No live API calls were made.
  • Repository Ruff lint and the CI format check for custom tests scripts examples pass; git diff --check passes.
  • Wheel and source distribution build successfully.
  • Full mypy still reports the existing generated core/unchecked_base_model.py:158 TypeForm incompatibility; the same error was reproduced after restoring the original compatibility modules.
  • Full regeneration was attempted with SKIP_FETCH=1 scripts/generate, but stops because a running Docker daemon is required. The custom source and derived mirror are byte-identical; fresh Fern generation has not been verified locally.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant