Skip to content

feat: AsyncClient / SyncClient feature parity + unified linting#303

Open
mlwelles wants to merge 15 commits intomainfrom
feat/async-client-feature-parity
Open

feat: AsyncClient / SyncClient feature parity + unified linting#303
mlwelles wants to merge 15 commits intomainfrom
feat/async-client-feature-parity

Conversation

@mlwelles
Copy link
Contributor

@mlwelles mlwelles commented Feb 27, 2026

Summary

Brings AsyncClient to full parity with SyncClient and consolidates all linting under Trunk as the sole orchestrator.

Async Client Feature Parity

  • Adds 14 methods to AsyncDgraphClient and 5 gRPC wrappers to AsyncDgraphClientStub, achieving 1:1 feature parity with the sync DgraphClient
  • New methods cover alter convenience wrappers (drop_all, drop_data, drop_predicate, drop_type, set_schema), DQL operations (run_dql, run_dql_with_vars), namespace management (create_namespace, drop_namespace, list_namespaces), and ID allocation (allocate_uids, allocate_timestamps, allocate_namespaces)
  • All methods mirror their sync counterparts exactly in signature, parameters, return types, JWT retry behavior, and error handling
  • Includes 26 new integration tests (38 total async client tests), all passing

Unified Linting (Trunk replaces pre-commit)

Consolidates three overlapping linting systems (pre-commit, Trunk, CI SKIP=... workarounds) into Trunk as the single orchestrator.

  • Removed .pre-commit-config.yaml and pre-commit/shellcheck-py dev dependencies
  • Enabled in trunk.yaml: mypy@1.18.2, pre-commit-hooks@6.0.0 (check-added-large-files, check-docstring-first, check-merge-conflict)
  • Added PGH rules to ruff config, replacing pygrep-hooks
  • Replaced all # type: ignore directives in non-generated code with per-module overrides in pyproject.toml for both mypy ([[tool.mypy.overrides]]) and ty ([[tool.ty.overrides]])
  • Updated Makefile: make check runs trunk check --all --no-fix + uv run ty check
  • Updated CI: code-quality workflow uses trunk check --all --ci plus standalone ty step
  • Fixed 37 ty type checker errors: corrected metadata types to match grpc-stubs, replaced lambda auth plugins with proper _AuthPlugin(grpc.AuthMetadataPlugin) class, annotated async stub types

Type Safety

Both mypy and ty now pass with zero errors and zero inline suppression comments in library code. Type mismatches between grpc-stubs and runtime behavior are handled via per-module config overrides rather than scattered # type: ignore directives.

Design document for adding 13 missing public methods to
AsyncDgraphClient to achieve 1:1 parity with the sync client.
Add 14 methods to AsyncDgraphClient and 5 gRPC wrappers to
AsyncDgraphClientStub, achieving 1:1 feature parity with
DgraphClient.

New async client methods:
- Alter wrappers: drop_all, drop_data, drop_predicate, drop_type,
  set_schema
- DQL operations: run_dql, run_dql_with_vars
- Namespace management: create_namespace, drop_namespace,
  list_namespaces
- ID allocation: allocate_uids, allocate_timestamps,
  allocate_namespaces (plus private _allocate_ids helper)

New async stub methods:
- run_dql, allocate_ids, create_namespace, drop_namespace,
  list_namespaces

All methods mirror their sync counterparts exactly in signature,
parameters, return types, JWT retry behavior, and error handling.

Includes 26 new integration tests (38 total async tests).

Closes #TBD
@mlwelles mlwelles requested a review from a team as a code owner February 27, 2026 04:15
@mlwelles mlwelles marked this pull request as draft February 27, 2026 04:17
@mlwelles mlwelles changed the title feat: async client feature parity with sync client feat: Fully implement AsyncClient Feb 27, 2026
@mlwelles mlwelles changed the title feat: Fully implement AsyncClient feat: AyncClient / SyncClient feature parity Feb 27, 2026
- Change metadata parameter types to tuple[tuple[str, str | bytes], ...] matching grpc-stubs
- Replace AuthMetadataPlugin lambdas with proper _AuthPlugin class
- Annotate async stub as DgraphAsyncStub for correct await inference
- Pass grace=None to async channel.close()
…re with per-module overrides

- Enable mypy@1.18.2, pre-commit-hooks@6.0.0, ty-check custom linter in trunk.yaml
- Re-enable trunk-fmt-pre-commit and trunk-check-pre-push actions
- Remove all # type: ignore directives from non-generated pydgraph code
- Add mypy per-module disable_error_code overrides in pyproject.toml
- Add ty per-file rule overrides in pyproject.toml [tool.ty.overrides]
- Move ty proto file excludes from CLI flags to [tool.ty.src] config
- ty-check uses output: regex with success_codes: [0] (strict)
- Remove .pre-commit-config.yaml
- Remove pre-commit and shellcheck-py from dev dependencies
- Update make check: pre-commit run -> trunk check --all --no-fix
- Update make setup: remove pre-commit install step
- Update CI code-quality workflow: use trunk check --all --ci directly
@mlwelles mlwelles changed the title feat: AyncClient / SyncClient feature parity feat: AsyncClient / SyncClient feature parity + unified linting Feb 27, 2026
…of trunk linter

- Add examples/** to trunk mypy ignore (examples have untyped code)
- Remove ty-check custom linter from trunk (shared org trunk action lacks uv)
- Run ty as separate step in code-quality workflow and make check
@mlwelles mlwelles marked this pull request as ready for review February 27, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant