Skip to content

Fix Datastore emulator failures caused by unsupported != query filters - #5418

Draft
letitz wants to merge 2 commits into
google:masterfrom
letitz:fix-emulator-queries
Draft

Fix Datastore emulator failures caused by unsupported != query filters#5418
letitz wants to merge 2 commits into
google:masterfrom
letitz:fix-emulator-queries

Conversation

@letitz

@letitz letitz commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Note: This pull request builds on top of base PR #5419 (fix-rodete-gcloud-apt).

When running unit tests locally against the Cloud Datastore Emulator (CloudDatastore.jar), multiple cron background task unit tests fail with gRPC / Datastore unknown errors or java.lang.IllegalArgumentException.

Root Cause:
google-cloud-ndb queries that filter string or numeric properties using the != (not equal) operator generate gRPC filter operator 9 (PropertyFilter.Operator.NOT_EQUAL). The Java-based Cloud Datastore Emulator (CloudDatastore.jar) does not support filter operator 9, throwing java.lang.IllegalArgumentException, which surfaces in Python unit tests as google.api_core.exceptions.RetryError wrapping Unknown.

Fix:
Replaced != query filters across 4 cron modules with equivalent supported filters:

  • For string properties where "" (empty string) is the lexicographical minimum value (bug_information), replaced bug_information != "" with bug_information > "".
  • For numeric and non-empty string properties, replaced prop != value with range inequality filters using ndb.OR(prop < value, prop > value).
  • Added inline documentation across all modified files explaining the Cloud Datastore emulator operator 9 restriction.

@letitz
letitz requested a review from a team as a code owner August 11, 2026 02:12
@letitz
letitz marked this pull request as draft August 11, 2026 02:49
letitz added 2 commits August 11, 2026 04:50
…lation conditional on rodete

When running local environment setup (./local/install_deps.bash) on internal
Google Linux workstations (rodete), apt-get fails when attempting to install
several optional App Engine and Pub/Sub component packages that are not
provided in internal apt repositories. Furthermore, attempting to add the
docker-ce repository triggers interactive glogin authentication even when
docker is already installed on the system.

Specifically:
- google-cloud-cli-app-engine-python, google-cloud-cli-app-engine-python-extras,
  google-cloud-cli-app-engine-go, and google-cloud-cli-pubsub-emulator apt
  packages are optional/unavailable on rodete (see internal references b/414408644
  and b/484368884).
- glogin and glinux-add-repo docker-ce-rodete should be skipped if docker is
  already installed on the machine.
- Fix pipenv CLI invocation in local/install_python_deps_linux.bash.

This commit updates local/install_deps_linux.bash to check $distro_codename and
whether docker is installed. On rodete, only google-cloud-cli and
google-cloud-cli-datastore-emulator are installed via apt-get, while non-rodete
distributions retain the full component package list. Additionally adds
local/tests/install_deps_test_linux.bash to test and verify fresh checkout
setup on Linux.
When running App Engine unit tests against the local Cloud SDK Datastore
emulator, NDB queries containing inequality filters (!=) fail because
the Java emulator backend does not support gRPC filter operator 9 (NOT_EQUAL).
This causes tests such as oss_fuzz_apply_ccs_test.py and
fuzzer_and_job_weights_test.py to fail with the following traceback:

    google.api_core.exceptions.RetryError: Maximum number of 3 retries exceeded while calling <function make_call.<locals>.rpc_call at 0x7f3527cf3240>, last exception: google.api_core.exceptions.Unknown

This commit replaces != query filters in NDB Datastore query objects across
cron handlers (oss_fuzz_apply_ccs.py, fuzzer_and_job_weights.py,
chrome_tests_syncer.py, retry_stuck_tasks.py) with supported inequality filters
(> and range inequality ndb.OR queries).
@letitz
letitz force-pushed the fix-emulator-queries branch from dfcb746 to 97cee57 Compare August 11, 2026 03:01
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