Repository navigation
perf(persistence): avoid formatting missing SQL attribute errors - #2776
Merged
Merged
Conversation
This was referenced Oct 26, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
huanghuoguoguo
marked this pull request as ready for review
October 27, 2026 03:19
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
SQL admission repeatedly reads optional AST attributes. SQLAlchemy's standard ColumnElement fallback formats AttributeErrors that getattr immediately discards. Avoid that formatting for the exact known fallback while retaining live instance, descriptor and comparator reads; unknown or changed fallbacks use normal getattr.
Every statement is still checked. No statement-validity cache, SQL admission rule, tenant fence or rollback-only protection is removed. Session event guards are unchanged.
Related: #2709 (follow-up profiling of the shared validation cost). This is independent of the pipeline read-count and event batching PRs.
Validation and limits
On this independently split branch:
pytest tests/unit_tests/persistence/test_tenant_uow.py -q: 125 passed. Added regressions cover mutable instances, comparator properties and a replaced fallback.Seven alternating same-process CPU measurements over real ORM SELECT/UPDATE/aggregate statements observed roughly 15–25% lower validation CPU, not whole-request latency. The combined SQL+UTF-8 candidate completed all 384 requests in a bounded ABBA comparison and observed +1.81%/+3.74% throughput, but one pair's overall P95 worsened by about 10%. Those combined results cannot isolate this patch's contribution or establish no regression. GC and high-load tail latency remain unresolved.
Keep the SQLAlchemy attribute-equivalence tests when upgrading that dependency. Draft for focused security/performance review.
Related review pieces
Author checklist