seitime-frappe/frappe
Ayaan Ahmad 3f86d478e8 perf(validation): optimize link validation with bulk pre-fetching
Implements a _prefetch_link_values method that bulk-fetches all link values
before validation, eliminating N+1 queries when saving documents with many
child rows containing Link/Dynamic Link fields.

Performance Impact:
- 50 child rows: 51 queries → 3 queries (94% reduction)
- 500 child rows: 501 queries → 3 queries (99.4% reduction)

Implementation:
- Uses instance-level cache (garbage collected after validation)
- Sentinel pattern to distinguish cache miss from cached-None
- DB-conditional case handling (MariaDB vs Postgres)
- Chunking at 1000 items for safety
- Backward compatible via **kwargs

Edge Cases Handled:
- Empty name lists (skip query)
- Invalid docname types (preserves existing assertions)
- Virtual doctypes (individual fetch)
- Single doctypes (special handling)
- Dynamic links with doctype changes (cache miss fallback)

Closes #35794
2026-01-12 20:23:54 +05:30
..
api refactor: telemetry with posthog and pulse providers 2026-01-03 16:21:49 +05:30
automation fix(assignment_rule): add a default option in due date based on 2025-12-24 11:40:04 +05:30
change_log
commands test: avoid flake from orphan gunicorn workers (#35798) 2026-01-09 17:09:17 +05:30
contacts fix(Contact): don't go to last doc on validation errors (#35165) 2025-12-10 22:13:17 +01:00
core fix: recreate system workspace 2026-01-12 00:04:24 +05:30
custom refactor: remove description from options field 2025-12-30 17:10:55 +00:00
data
database fix(query): handle string argument with between 2026-01-08 16:34:27 +05:30
desk fix: cleanup workspace for website 2026-01-11 23:43:11 +05:30
desktop_icon chore: reexport desktop icons with new schema 2026-01-02 19:02:04 +05:30
email Merge pull request #34801 from alexleach/html_emails 2026-01-06 12:21:03 +05:30
geo fix: enable translated languages (#35003) 2025-12-01 16:50:50 +00:00
gettext feat(translations): add hook to exclude translatable strings from dependencies (#34544) 2025-11-10 12:50:21 +01:00
integrations fix(oauth2): introspect_token requires token (#35647) 2026-01-05 13:41:12 +00:00
locale fix: Indonesian translations (#35824) 2026-01-11 18:52:03 +01:00
model perf(validation): optimize link validation with bulk pre-fetching 2026-01-12 20:23:54 +05:30
modules feat: import custom DocType Links on app install/migrate (#34516) 2026-01-02 17:39:17 +05:30
patches fix: add better error handling 2026-01-09 13:03:28 +05:30
printing fix: load correct sidebar for printview 2026-01-08 09:30:53 +05:30
public Merge pull request #35836 from diptanilsaha/sw_tt 2026-01-12 08:27:28 +05:30
pulse fix: add compatibility shim for old frappe.pulse.utils imports 2026-01-05 13:28:25 +05:30
query_builder feat: implement field masking for query builder (#35230) 2025-12-16 12:08:13 +05:30
search fix: deduplicate documents in search index while updating 2025-12-31 18:06:44 +05:30
templates fix(login): don't let button text stuck at "Verifying" if you get rate limited (#35671) 2026-01-05 17:12:28 +00:00
testing refactor: tomli -> tomllib 2025-12-22 21:06:48 +05:30
tests fix!: disallow setting link values not matching filters 2026-01-10 13:25:35 +05:30
types fix: disable UP040, revert some instances to TypeAlias 2025-12-23 13:12:04 +05:30
utils Merge pull request #35683 from akhilnarang/fix-ipv6-connection-check 2026-01-08 19:38:51 +05:30
website fix: cleanup workspace for website 2026-01-11 23:43:11 +05:30
workflow feat: Support dynamic expressions in workflow update_value field (#34354) 2025-12-30 15:58:43 +05:30
workspace_sidebar refactor: remove productivity sidebar 2026-01-10 13:18:19 +00:00
www perf: misc v16 fixes (#35790) 2026-01-09 11:06:06 +00:00
__init__.py fix: ruff "unsafe" fixes 2025-12-22 21:06:48 +05:30
_optimizations.py Revert "fix: Pin web workers by default (#31739)" (#32852) 2025-06-09 09:52:23 +00:00
app.py fix: handle trying to decode invalid JSON (#34167) 2025-09-29 11:07:53 +05:30
apps.py perf: Cache get_apps and internals 2025-12-23 16:06:10 +05:30
auth.py chore: rename from app to desk 2025-11-14 23:05:13 +05:30
boot.py chore: rename patch 2026-01-02 19:02:04 +05:30
build.py fix: remove flush all while build assets, as asset build should never clear entire redis database. (#34874) 2025-11-25 11:51:32 +05:30
cache_manager.py fix: clear cache and prevent data access after DocType deletion (#34307) 2025-10-10 08:00:51 +00:00
client.py fix: handle edge case where value may not exist in db 2026-01-10 14:43:23 +05:30
config.py feat: init sqlite 2025-04-15 13:59:16 +05:30
coverage.py fix: ignore 'test_*' directories 2025-08-14 18:16:41 +05:30
defaults.py perf: client-cache for defaults 2025-01-07 12:51:10 +05:30
deferred_insert.py fix: ruff fixes 2025-12-22 21:06:48 +05:30
deprecation_dumpster.py refactor(treewide): ruff format 2025-09-26 13:16:43 +05:30
exceptions.py fix: Implement backpressure for background jobs 2025-03-05 10:59:00 +05:30
frappeclient.py fix: make sure limit is an integer 2025-11-19 21:15:57 +05:30
handler.py fix: Allow GIF uploads (#35295) 2025-12-17 08:48:31 +00:00
hooks.py refactor: telemetry with posthog and pulse providers 2026-01-03 16:21:49 +05:30
installer.py refactor: move auto generations of icons to a command 2025-11-14 23:05:12 +05:30
locale.py feat: cache documents in client cache 2025-01-14 14:33:10 +05:30
middlewares.py fix(middleware): check path before returning file (#34651) 2025-11-10 16:02:36 +05:30
migrate.py fix: handle names with parenthesis 2025-12-07 23:09:44 +05:30
modules.txt fix: remove energy points / social module 2025-04-17 00:26:57 +05:30
monitor.py fix: ruff fixes 2025-12-22 21:06:48 +05:30
oauth.py perf: Skip link checking on internal deletes 2025-01-06 11:48:19 +05:30
onboarding.py fix: added get_onboarding_status api 2025-03-18 18:06:30 +05:30
parallel_test_runner.py refactor: introduce lightmode in parallel test runner 2025-06-19 11:40:09 +05:30
patches.txt fix: add patch to add standard field 2026-01-08 19:54:13 +05:30
permissions.py refactor: better permission check for single doctypes 2025-12-22 12:13:26 +05:30
push_notification.py fix(push_notification): improve check before returning token 2025-12-11 12:43:06 +05:30
rate_limiter.py fix: Round of rate limit to seconds (#31674) 2025-03-12 10:52:42 +00:00
realtime.py fix: frappe.local has not _realtime_log (#33236) 2025-07-07 11:06:04 +05:30
recorder.py feat: remove strip_dirs in Recorder python cProcfile (#33300) 2025-07-15 17:51:44 +05:30
sessions.py fix: ruff fixes 2025-12-22 21:06:48 +05:30
share.py fix(docshare): validate that the user has the permission they are trying to share 2025-12-24 14:13:05 +05:30
test_runner.py refactor: organize test contextmanagers (#28041) 2024-10-09 02:09:19 +02:00
translate.py fix: check len(item) before replace "\\n" with "\n" (#35571) 2026-01-05 18:31:09 +05:30
twofactor.py feat: configure SMS OTP template for 2FA (#34585) 2025-11-04 12:32:57 +00:00