Skip to content

🐛 Fix TurboRouter dual-hash APQ lookup for Apollo Client queries (v0.10.1)#74

Merged
evoludigit merged 1 commit into
devfrom
bugfix/turbo-apq-hash-context
Oct 5, 2025
Merged

🐛 Fix TurboRouter dual-hash APQ lookup for Apollo Client queries (v0.10.1)#74
evoludigit merged 1 commit into
devfrom
bugfix/turbo-apq-hash-context

Conversation

@evoludigit
Copy link
Copy Markdown
Contributor

Summary

Fixes critical bug where TurboRouter failed to activate for Apollo Client APQ requests when using dual-hash registration, causing 30x-50x performance degradation (600ms instead of <20ms).

Problem

When queries were registered with dual-hash support for Apollo Client APQ compatibility, TurboRouter would fail to find them during query execution if the query text hashed to the apollo_client_hash instead of the server hash.

Root Cause

  • TurboRegistry.get(query_text) only checked normalized and raw hashes
  • Never checked the _apollo_hash_to_primary mapping
  • When query text from APQ hashed to Apollo Client hash, lookup failed
  • TurboRouter fell back to normal execution mode

Solution

Enhanced TurboRegistry.get() to check the apollo hash mapping after trying direct hash lookups. Now correctly resolves Apollo Client hashes to their registered primary hashes.

Impact

  • ✅ Restores 30x-50x performance for dual-hash APQ queries (600ms → 15ms)
  • ✅ 100% backward compatible - no code changes required
  • ✅ Works with most common production GraphQL client (Apollo Client)
  • ✅ Completes dual-hash support implementation

Files Changed

  • src/fraiseql/fastapi/turbo.py - Enhanced get() method with apollo hash mapping lookup
  • tests/test_apollo_client_apq_dual_hash.py - Added regression test
  • pyproject.toml - Version bump to 0.10.1
  • src/fraiseql/__init__.py - Version bump to 0.10.1
  • CHANGELOG.md - Added release notes for 0.10.1
  • RELEASE_NOTES_v0.10.1.md - Detailed release documentation

Testing

  • ✅ New test: test_get_by_query_text_with_dual_hash_apollo_format validates the fix
  • ✅ All 7 Apollo dual-hash tests pass
  • ✅ All 5 hash issue tests pass
  • ✅ All 15 TurboRouter integration tests pass
  • ✅ All 25 turbo-related tests pass
  • ✅ Full test suite passes (3,306 tests)

Release

This PR includes:

  • Version bump to 0.10.1
  • Git tag v0.10.1 created
  • Release notes in RELEASE_NOTES_v0.10.1.md
  • CHANGELOG.md updated

🤖 Generated with Claude Code

Fixes critical bug where TurboRouter failed to activate for Apollo Client APQ
requests when using dual-hash registration, causing 30x-50x performance
degradation (600ms instead of <20ms).

Problem:
- TurboRegistry.get() only checked normalized and raw hashes
- Never checked _apollo_hash_to_primary mapping
- When query text from APQ hashed to apollo_client_hash, lookup failed
- TurboRouter fell back to normal execution mode

Solution:
- Enhanced TurboRegistry.get() to check apollo hash mapping
- Now correctly resolves Apollo Client hashes to primary hashes
- Maintains LRU behavior for all lookup paths
- 100% backward compatible

Impact:
- Restores 30x-50x performance for dual-hash APQ queries
- No code changes required for existing applications
- Works with most common production GraphQL client (Apollo Client)

Testing:
- New test: test_get_by_query_text_with_dual_hash_apollo_format
- All 25 turbo-related tests pass
- Full backward compatibility maintained

Files changed:
- src/fraiseql/fastapi/turbo.py - Enhanced get() method
- tests/test_apollo_client_apq_dual_hash.py - Added regression test
- pyproject.toml - Version bump to 0.10.1
- src/fraiseql/__init__.py - Version bump to 0.10.1
- CHANGELOG.md - Added release notes for 0.10.1
- RELEASE_NOTES_v0.10.1.md - Detailed release documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@evoludigit evoludigit merged commit d61ed9b into dev Oct 5, 2025
10 checks passed
@evoludigit evoludigit deleted the bugfix/turbo-apq-hash-context branch October 5, 2025 06:53
evoludigit added a commit that referenced this pull request May 12, 2026
* chore(deps): bump security-critical Python dependencies

## Changes

- urllib3: >=2.6.0 → >=2.7.0 (fix headers forwarded across origins, decompression-bomb bypass)
- langchain-core: >=1.2.28 → >=1.3.3 (fix unsafe deserialization via load() allowlists)
- banks: add >=2.4.2 constraint (fix critical RCE via Jinja2 SSTI)
- cryptography: >=46.0.6 → >=47.0.0
- llama-index/llama-index-core: >=0.14.15 → >=0.14.21
- ruff: >=0.15.0 → >=0.15.12
- opentelemetry-*: >=1.39.0 → >=1.41.1
- aioboto3: >=15.0.0 → >=15.5.0
- protobuf: upper bound relaxed from <7.0 to <8.0

Resolves Dependabot alerts #74, #75, #76, #77, #78.

## Verification
✅ 3229 unit tests pass
✅ ruff checks pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Lionel Hamayon <lionel.hamayon@evolution-digitale.fr>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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