From 1fa86c42d58a2aa6a3cb44827afa500e9b6ab8e3 Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Tue, 1 Dec 2026 23:13:37 +0200 Subject: [PATCH 01/11] =?UTF-8?q?=D7=90=D7=99=D7=A0=D7=93=D7=95=D7=A7?= =?UTF-8?q?=D7=A1:=20=D7=97=D7=96=D7=A8=D7=AA=20=D7=A6=D7=A0=D7=A8=D7=AA?= =?UTF-8?q?=20PDF,=20=D7=A9=D7=99=D7=AA=D7=95=D7=A3=20=D7=94=D7=9E=D7=A8?= =?UTF-8?q?=D7=95=D7=AA=20=D7=95=D7=90=D7=91=D7=97=D7=95=D7=9F=20=D7=9E?= =?UTF-8?q?=D7=93=D7=99=D7=93=20(#6187)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/perf_probe.yml | 49 +++ .../issue6187/after-compact-dark.png | Bin 0 -> 13460 bytes .../issue6187/after-compact-light.png | Bin 0 -> 13422 bytes .../issue6187/after-desktop-dark.png | Bin 0 -> 15089 bytes .../issue6187/after-desktop-light.png | Bin 0 -> 15201 bytes .../issue6187/before-compact-dark.png | Bin 0 -> 11675 bytes .../issue6187/before-compact-light.png | Bin 0 -> 11589 bytes .../issue6187/before-desktop-dark.png | Bin 0 -> 13032 bytes .../issue6187/before-desktop-light.png | Bin 0 -> 12973 bytes .../database_library_provider.dart | 70 ++- lib/indexing/bloc/indexing_bloc.dart | 32 ++ lib/indexing/bloc/indexing_event.dart | 11 + lib/indexing/bloc/indexing_state.dart | 7 + lib/indexing/indexing_work_status.dart | 5 +- .../models/indexing_resource_policy.dart | 40 +- .../models/indexing_run_diagnostics.dart | 119 +++++ lib/indexing/models/indexing_run_result.dart | 5 + .../repository/indexing_repository.dart | 316 ++++++++++---- .../services/indexing_failure_reporter.dart | 22 +- lib/indexing/utils/indexing_crash_canary.dart | 7 +- .../utils/pdf_extraction_prefetcher.dart | 3 + .../services/external_book_import.dart | 12 +- .../sync/background_db_sync_worker.dart | 11 +- lib/utils/file/docx_cache.dart | 114 ++++- test/indexing/bloc/indexing_bloc_test.dart | 38 ++ test/indexing/bloc/indexing_state_test.dart | 5 + test/indexing/indexing_work_status_test.dart | 14 + .../models/indexing_resource_policy_test.dart | 62 +++ .../models/indexing_run_diagnostics_test.dart | 87 ++++ .../repository/indexing_repository_test.dart | 182 +++++++- .../repository/pdf_text_timeout_test.dart | 14 + .../indexing_failure_reporter_test.dart | 37 ++ .../utils/indexing_crash_canary_test.dart | 36 ++ .../utils/pdf_extraction_prefetcher_test.dart | 22 + ...ternal_book_conversion_benchmark_test.dart | 137 ++++++ .../external_book_conversion_cache_test.dart | 413 ++++++++++++++++++ .../indexing_progress_capture_test.dart | 116 +++++ .../indexing_native_probe_test.dart | 219 ++++++++++ tool/perf_probe/run_indexing_pair.py | 166 +++++++ tool/perf_probe/test_indexing_pair.py | 59 +++ .../verify_indexing_recovery_regression.py | 46 ++ 41 files changed, 2331 insertions(+), 145 deletions(-) create mode 100644 docs/screenshots/issue6187/after-compact-dark.png create mode 100644 docs/screenshots/issue6187/after-compact-light.png create mode 100644 docs/screenshots/issue6187/after-desktop-dark.png create mode 100644 docs/screenshots/issue6187/after-desktop-light.png create mode 100644 docs/screenshots/issue6187/before-compact-dark.png create mode 100644 docs/screenshots/issue6187/before-compact-light.png create mode 100644 docs/screenshots/issue6187/before-desktop-dark.png create mode 100644 docs/screenshots/issue6187/before-desktop-light.png create mode 100644 lib/indexing/models/indexing_run_diagnostics.dart create mode 100644 test/indexing/models/indexing_run_diagnostics_test.dart create mode 100644 test/migration/sync/external_book_conversion_benchmark_test.dart create mode 100644 test/migration/sync/external_book_conversion_cache_test.dart create mode 100644 test/support/indexing_progress_capture_test.dart create mode 100644 test/tool/perf_probe/indexing_native_probe_test.dart create mode 100644 tool/perf_probe/run_indexing_pair.py create mode 100644 tool/perf_probe/test_indexing_pair.py create mode 100644 tool/perf_probe/verify_indexing_recovery_regression.py diff --git a/.github/workflows/perf_probe.yml b/.github/workflows/perf_probe.yml index c87d54243a..96920d8526 100644 --- a/.github/workflows/perf_probe.yml +++ b/.github/workflows/perf_probe.yml @@ -3,6 +3,14 @@ name: Performance probe tools on: pull_request: paths: + - 'lib/indexing/**' + - 'lib/migration/services/external_book_import.dart' + - 'lib/utils/file/docx_cache.dart' + - 'lib/utils/file/document_converter.dart' + - 'test/tool/perf_probe/indexing_native_probe_test.dart' + - 'tool/perf_probe/run_indexing_pair.py' + - 'tool/perf_probe/test_indexing_pair.py' + - 'tool/perf_probe/verify_indexing_recovery_regression.py' - 'tool/perf_probe/**' - 'tool/ci/prepare_native_build_dependencies.py' - 'tool/release/download_release_asset.sh' @@ -91,6 +99,47 @@ concurrency: cancel-in-progress: true jobs: + indexing_pair: + name: Native indexing pair (debug harness, same Windows host) + needs: gate + if: github.event_name == 'pull_request' && needs.gate.outputs.run == 'true' + runs-on: windows-2025 + timeout-minutes: 90 + steps: + - uses: actions/checkout@v7.0.1 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - uses: ./.github/actions/setup-flutter + with: + flutter-version: 3.47.9 + - uses: dtolnay/rust-toolchain@stable + - name: Validate comparison contracts + run: python -B -m unittest tool.perf_probe.test_indexing_pair -v + - name: Compare immutable sources with alternating launches + shell: pwsh + env: + INDEX_BASELINE: ${{ github.event.pull_request.base.sha }} + INDEX_CANDIDATE: ${{ github.event.pull_request.head.sha }} + run: | + git config --global core.longpaths true + flutter pub get --enforce-lockfile + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + python -B tool/perf_probe/verify_indexing_recovery_regression.py --baseline $env:INDEX_BASELINE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair/regression') + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + flutter test --no-pub --concurrency=1 --dart-define=OTZARIA_IMPORT_CACHE_BENCH=true test/migration/sync/external_book_conversion_benchmark_test.dart 2>&1 | Tee-Object -FilePath (Join-Path $env:RUNNER_TEMP 'indexing-pair/import-conversion.log') + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair') --warmups 1 --repetitions 5 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Preserve raw timings, completeness and partial failures + if: always() + uses: actions/upload-artifact@v7.0.2 + with: + name: indexing-native-pair + retention-days: 14 + if-no-files-found: warn + path: ${{ runner.temp }}/indexing-pair/** + gate: uses: ./.github/workflows/ci_gate.yml permissions: diff --git a/docs/screenshots/issue6187/after-compact-dark.png b/docs/screenshots/issue6187/after-compact-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..a246671ee35ffaad9c6f7172bc0e46a2cd150523 GIT binary patch literal 13460 zcmeHuWmHsQ+wK5LC?O$Tf`XDF-KjLv-Q6jj3eq7`(nurS-3`()bPt_FBXJ(yb=LX! z{X6TNKQC*sW@gXc`+4@=_jTP9A}=S7@r?Kx1Oma3ln_&dKoHCy|51^_5f7Nb6nJ^! zBqFJd3jVxMjf25w1Sdst5lG1}=?(-!36T^NR(4A{SajEpQ&~ek?u9V_bJPf+|CYb< z4VCWOcz}q1OuUIfqO1v~YRs&%oa`{0g=Y4(51n!IEI^>N8h+legj63`CB-Mrx-thiCtswSWK)r zG&Pkmg_KOcRMB8mNH2xY6Z8CB)4h2LQS)FG`7@TQu`x`2-Cj)0Tdr@k{p~wO@sBF( z`o$dPwBjgke~5;~#8RVu4*8mzC+)wKp%lFwr4GXS*ux#jimhOllg=A8irwzVjyTu3 zh*3}QyjX#WiVE>ZvL3{h6FQ7iRalAp1%qcVHZ(YRbTq?1tWs$UX>M`osk3JBQ!O0q z=r_B&)%LDVJ6=Nb^Mx~Uk->eTOgfg|vi$keU%#fpQK>~f>&ib-oed1mXWp*yBgerD zHcNBEo5<}+UNoJXbmKei%0joG$~;8hF4`ycx;n{o+y3hLQq<$|yR)|DtK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I1xX^2K+Kw+)!^WpZ1A0eymDwy&nJkGpkDRFODnR4r6qC$>Y!Jgt*96n z82N?JwecJpE3&lUe6{k*O8=NFr2PXGRKo4BNu`}p_U(;xRSa`Tog?ho!lL%-+WwR3 zMtV}x{bF}Fs!ZK1-Fd&z0ZRZf{;v2#e0Ouss&01 literal 0 HcmV?d00001 diff --git a/docs/screenshots/issue6187/after-compact-light.png b/docs/screenshots/issue6187/after-compact-light.png new file mode 100644 index 0000000000000000000000000000000000000000..f77e141387e4f873a5e3933ffdff1ee0204f3f96 GIT binary patch literal 13422 zcmeHuWmHsA|L!12CAJLEGYtk4v=p`AXJc#VjomJQg&xObyd}tg${7(`~E)0d_zTp zRc&v%qHnpTQlm(?$_4+I*4xXrTQJs@(^0mggs4#7Hph*LO)|C8e#7v6O{C^;SWp1< zgEDOF$mV_AYM9nuupx0Ms^46RM#&1)e6QJjAjNx+$Bn~uniLQJyTeX$9YjnlI|@Zk z>=ixwd;ISi#6x0YUyOta@UbHPd-A^q`L8qlKMaJz;!|9$z|1fFzpNfB>3$16DpTH0 z{}Pt}+`-B1b6q^H?hOCp;wozMz^4X1xx}hYZ8}EA@g^gRw78hqkcF<2sz>D}N-@*FP>Fr$OMHBe=+2H=UXG1I>*qVt zl42&}wlByXi_20Jo<7A7@6AO?O;0zEwG9iiL*smGkt!c*iuA+M(n>5un3$RxO*I)9 zNfF>rv1M?O;^=EuW7-$%LWxJfbr0)Rr~1DR`1K9GHfnEaXbh(+!e3HRDY9mtw((F= z4aJGm&^(Rnw|`0+`o1kOOlr!N*sj9xiW(m@a$+XExwwU6a2-*hY**gY;s|lESAS>~JYBC~fg7x! zg0v7@F1!}+le}O(gM-U~Z^T^M_`GQ*s^rLVg4rSWR!%kB#E=t<1D7T3?4UR0kwuRm zJWs-wan0%e*Zp2IJux&@)?t5k&3Ip4^l@*h~^zmN9O~207e0!Zu*UPJ` zRs=%F(ICfI%2dfKdW1E{RT{2>Q`jX`J#L} zhc-Y09Nl9$xREJ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q#ER zQI}8huGjklQ7JqdEhV#&PT+;&um-nZM6f;su%7f!eD60GBbHW-sMsdyYZvSeP<-Cr zS*3!ydC%jXP&|Eo?xXZ_Rx|Qyoi}peHShe_%5%o2G5aB)RjZj|06krJm%A|_%c<=m zB7%S$UpsDFpU&<4Fi8{oJ=rf`_yGs#R(rA3uC~rV@Ih6ue^)bX&b;g_4HST`043Z- zz}hcewbsi(0(MT=fhZJQ7ccb0)|(6NHA43nh3+Z$jwt)DbSp6i<^8v?JSp{4skxKgNhgg_2J zvq|F8b@S4WEKSEbb8dO67l+;QZ6$f!L_+u&cupAL?O4ufhmmGy&7))o*WYc?5fMQg zVB;N1ssMhUA9!^m^Z)Xz8%g9tZf8%xz9GZZ5j=c+sG52+G+J~Nb$YIa#FV%AKO4B| z8OK{2i=9VNwU@V0^svBgz;116nMy#NaSCMcJw$)Wb)EU2f9&pS43q!dB8O`sDJkhu zfh(b{{KZvTLd*qKMvniX0+QLmr9y=4Jp>KiRl+k?fH_UbHo6TTfA-sm%AGJc@!-K1 z2;@KSu2_>-gH7n0o0jxFgJRcD^fDYBgUchyz)k|~@v9=f#`S;~h9Dos<;9>PpT7JrN0rV| literal 0 HcmV?d00001 diff --git a/docs/screenshots/issue6187/after-desktop-dark.png b/docs/screenshots/issue6187/after-desktop-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..84a41b677ca62faf2df95ee08589d93ff7223337 GIT binary patch literal 15089 zcmeHuXHZk!_in5p-B*z&U;(8FC{^i-fC1@E0s#@}O?nR~2rBJ0RB55t(3^y&prC}_ zA|)Ww2?2o+B(%HZ@0PFk!=1Tv=l+>tPLgx>+54=$>hrAgR##h{k&crN0)a3>A3fBE zKu(22ASdi;&w^i=O{56maN6?$)Q}eZ1<^i#1HPZ|)K`B1Det?y0)bqCKp);W^h+n= z{rwCV@SU4n@&773zs`3Djii0X_u%V{cd>xypkbtE)O(?u^9BGtoV+sI&UU~tuu zTh17#7fA#8krEfzaPri_!V;nMWucnWWS>GwNy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T`OU5q1PwKAiv@-}FQ%@5aR984KIkjB z*x={yn=ydD!^9Nqc3AUN9JA%zDn5)yM(DoUL(kgKs4n8WxktVem=v)SmC$rjae`sBxps8Ax*~utGonVBWb{IHU-lx(Wp4k+nD008HnO$1S0wC>EQw zCdK~xE1CFt_7>Cc`Q>Z>n-nvwPA_FAy?*Z0Y#eBX$L_X+Z;Mf1J{G@eSz{}6D^Q*d zfVKw!ZAi9a2&fw>E>H6Pzxj}#30`$&X->PGk#V(*69TEifu~?PEt_0dfEM7K;>u0m zWwj@a&WFiPfV`v=+&;bSiNpL=o%q2cBr}JRPtkm!Go1H5JzKz5ga7$J%Fwwt@^3=k zdsdx*yvrUnWU2Dic>15mDU88SE-n_o3wWbFgDCbCrh&YRKfl;otrP3Hz4en@4KSu6 zUB}CbE2AcRn)C8)5l%2EI*4j%%7t)~@HeeJy$C5kAux&-e|e1mh`zV?hm_RRwAB2f z0B%J8GFJS*9_wKT$>Y`r=+L%LBiIExvb7MA8sQvu?K%R5$+?sU7C@yuV^qxAntLga zazzgfB3=($SyJ&{EQbzao@SO{3i?`|p)BLiuvzu|Id~R``m9d<&`IFd1FG)wIQK7~ f`v2Hdn-pG*E)>m#E&*yB1OnC6)u>Z@{LlXY@fHs! literal 0 HcmV?d00001 diff --git a/docs/screenshots/issue6187/before-compact-dark.png b/docs/screenshots/issue6187/before-compact-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..a73ee637af54b1ee6cc2903600889c8a5da100b8 GIT binary patch literal 11675 zcmeHtWmFtb^yLsN5Hz^MkU$8Y;4YKk!QI^kcZUE2fdC=6lK_F>4#6$B1sh;+cX!?9 z_iaD!+5NQVKj+Mu>8|eTuJ`V%y7$%lqV!1$8El36;uI8D(Kkucdw!VUPgsvTyVN9dk zg~I)zSD$6Ba%_yNDRpuPv#Jt$Jas=~$7y$}kyOfSH#x{+_wSu<@tzHd>c2V1J`~hg zzd&O{H1U9dHcHDSN>U@rg`myb>ob|*rcL2Pva=MAh11N-Y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vi+3e?Ek(O3B^Pdd!B+I-sF`wXZd5^&YP^yu6K{WPKMA(smh>9>^e4{fXY=B4} zl_{Xd0@QPskb=tO!e{N!PC%}paO2qoH55`oE|H4_4lNYa~kN;a`N8`MT4DKMy1$pUDfV{ygO*&(X!A|GgZs|`d>LnV2EuzvY+kEndN zzvMHaZ+ZJ#-&z1YDnsg^AQW5?OAeiW2wM>Wu7d){%{`4%YE37FI-s_Q(2A>F1x zb!LPr!zrL6AV9zY$~%_I^3xCtPh+OIAH~5M*IlrJ1J>P_P9HgQU@9TDa@u`z@+>2e zdB{OWl|$roAZI(fE8TI}$lb>@|9Jrj2H;8b`to+$U?XK~?o8iZO}g$Z*1n@5ChjUy zr^jhneE>9W*a<+;sAp8rU?-=QjWVF>vG&G~a0lRW*U^K3`#HSJ(Ks56ET6M*;ix}F z1QG6E@Uc~=eo`kokI=r*wwZn7tc9;UDQer#-0nF6VyWPx7}MVm~PfT1lE!rK5f$CdNp%W}tTtElM2#%T?zPt2y6rbaLT zuq(ve@>uye;LVWBlPC44e;~On`-Jab(HOQo!k>n>+R10E-MdNFywSZ@7Shnu;t@`? zIrDY%Ji@=k<#W-HZwfdI%Ch!$VVRA~!JAfv#PAQHy@}jXiM5o#(v#3_I#6Uo)HBFz z%a$C!Zv$Agd@TbaLb z_#|RuW22<49tG6Dv8W5<#|~8h@}Mydv$XUruth@0z2Bt0j3tN81=4G9#aJ--uU2pt zLGU&q@^uj-xRQw|;lDaT?GHq_B=g}Dq*TJ_^Zx>!5ejVp literal 0 HcmV?d00001 diff --git a/docs/screenshots/issue6187/before-compact-light.png b/docs/screenshots/issue6187/before-compact-light.png new file mode 100644 index 0000000000000000000000000000000000000000..f1b85e9f8985bfc5b53b12ee14cd135baae64080 GIT binary patch literal 11589 zcmeHt^;c9;|L#EqltxlgPyuO_ZUg~o5Re+W8|m&60TF5G?#`i+5TtV$2BdrFu6uaD z_x=a>{&LsLTCk z|2=kk|55D;_~-q^Bpkd(aZ;6j50np6ZUM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B^V(^B&%|_Tn4>NOc6=_*qVjeB~P@xVGn`6D=%G=b`B9;A} zlKjc?tzl(Ya*Fux4ai{eKeRN0*F=q#u1kKajW_CDakNSWd-T+4Ly^k3LmW9KFHkQt j{O|19|KtB%9CLr&9L#JM-=O{*3IwXE^{`y|>A(L6uet7i literal 0 HcmV?d00001 diff --git a/lib/data/data_providers/database_library_provider.dart b/lib/data/data_providers/database_library_provider.dart index f3c98c550c..4828ea43ec 100644 --- a/lib/data/data_providers/database_library_provider.dart +++ b/lib/data/data_providers/database_library_provider.dart @@ -1,3 +1,5 @@ +import 'package:otzaria/utils/file/docx_cache.dart'; + import 'dart:async'; import 'dart:collection'; import 'dart:io'; @@ -293,6 +295,27 @@ void _tryCreateBookFilePathIndex(sqlite3.Database reader, String dbPath) { } /// מסננת קבצים ללא שינוי ומכינה כותרות טקסטואליות מחוץ ל-UI isolate. +Future> _scanExternalFolderWithCache( + ({ + String folderPath, + String folderName, + String dbPath, + String? cachePath, + Map> queries, + }) + input, +) async { + QueryLoader.seedCache(input.queries); + return withImportConversionCache( + input.cachePath, + () => _scanExternalFolderInIsolate(( + input.folderPath, + input.folderName, + input.dbPath, + )), + ); +} + Future> _scanExternalFolderInIsolate( (String folderPath, String folderName, String dbPath) args, ) async { @@ -419,13 +442,18 @@ Future _collectBookFilesRecursive( Future>> scanExternalFolderForTest( String folderPath, String folderName, - String dbPath, -) async { - final result = await _scanExternalFolderInIsolate(( - folderPath, - folderName, - dbPath, - )); + String dbPath, { + String? conversionCachePath, +}) async { + await QueryLoader.initialize(); + final input = ( + folderPath: folderPath, + folderName: folderName, + dbPath: dbPath, + cachePath: conversionCachePath, + queries: QueryLoader.cacheSnapshot, + ); + final result = await Isolate.run(() => _scanExternalFolderWithCache(input)); return result .map((b) => {'path': b.book.filePath, 'existingBookId': b.existingBookId}) .toList(); @@ -2473,15 +2501,16 @@ class DatabaseLibraryProvider implements LibraryProvider, LinkLinesProvider { ? trustedDbTarget(_sqliteProvider.dbPath) : null, UserBookSource() => null, - AttachedBookSource(:final slug) when !AttachedLibraryRegistry.pathsPending => + AttachedBookSource(:final slug) + when !AttachedLibraryRegistry.pathsPending => switch (AttachedLibraryRegistry.instance.libraryFor(slug)) { - final library? => ( - path: library.path, - untrusted: true, - immutable: library.immutable, - ), - null => null, - }, + final library? => ( + path: library.path, + untrusted: true, + immutable: library.immutable, + ), + null => null, + }, AttachedBookSource() => null, }; @@ -5803,8 +5832,17 @@ class DatabaseLibraryProvider implements LibraryProvider, LinkLinesProvider { // הוספת תיקייה משווה רק ל-user_books.db; האוסף כולו רץ ברקע. final dbPath = await UserBooksDatabaseHolder.resolveDbPath(); + final cachePath = await resolveImportConversionCachePath(); + await QueryLoader.initialize(); + final scanInput = ( + folderPath: folderPath, + folderName: folderName, + dbPath: dbPath, + cachePath: cachePath, + queries: QueryLoader.cacheSnapshot, + ); final discovered = await Isolate.run( - () => _scanExternalFolderInIsolate((folderPath, folderName, dbPath)), + () => _scanExternalFolderWithCache(scanInput), ); debugPrint( '📁 Isolate found ${discovered.length} books to process in $folderPath', diff --git a/lib/indexing/bloc/indexing_bloc.dart b/lib/indexing/bloc/indexing_bloc.dart index ea7b7c1457..268519d47d 100644 --- a/lib/indexing/bloc/indexing_bloc.dart +++ b/lib/indexing/bloc/indexing_bloc.dart @@ -29,6 +29,8 @@ class IndexingBloc extends Bloc { int? _activeWorkId; bool _isPaused = false; bool _isFinalizing = false; + int? _pdfPagesProcessed; + int? _pdfTotalPages; // ביטול מנקז את ריצות האינדוקס שכבר בתור: הן נשלחו לפני שהמשתמש עצר. final _enqueuedAtCancelCount = Expando(); @@ -66,6 +68,7 @@ class IndexingBloc extends Bloc { on(_onActualIndexingStarted); on(_onFinalizing); on(_onUpdateProgress); + on(_onPdfProgress); } /// Factory constructor that creates an IndexingBloc with a default repository @@ -98,6 +101,8 @@ class IndexingBloc extends Bloc { isPaused: _isPaused, isEconomy: _repository.isEconomyIndexing, isFinalizing: _isFinalizing, + pdfPagesProcessed: _pdfPagesProcessed, + pdfTotalPages: _pdfTotalPages, ); Future _onIndexingWork( @@ -268,6 +273,8 @@ class IndexingBloc extends Bloc { Emitter emit, ) async { final workId = ++_nextWorkId; + _pdfPagesProcessed = null; + _pdfTotalPages = null; final runClock = Stopwatch()..start(); _activeWorkId = workId; @@ -300,6 +307,11 @@ class IndexingBloc extends Bloc { }, onActualIndexingStarted: () => add(ActualIndexingStarted(workId)), onProgress: _progressOf(workId), + onPdfProgress: (processed, total) { + if (!isClosed && _activeWorkId == workId) { + add(UpdatePdfIndexingProgress(workId, processed, total)); + } + }, onFinalizing: () => add(IndexingFinalizing(workId)), ), ); @@ -370,6 +382,8 @@ class IndexingBloc extends Bloc { final currentState = state; if (currentState is! IndexingInProgress) return; _isFinalizing = true; + _pdfPagesProcessed = null; + _pdfTotalPages = null; emit( _inProgress( booksProcessed: currentState.booksProcessed, @@ -459,6 +473,8 @@ class IndexingBloc extends Bloc { void _cancelWork() { _activeWorkId = null; + _pdfPagesProcessed = null; + _pdfTotalPages = null; _isPaused = false; _cancelCount++; _repository.cancelIndexing(); @@ -540,4 +556,20 @@ class IndexingBloc extends Bloc { ); } } + + void _onPdfProgress( + UpdatePdfIndexingProgress event, + Emitter emit, + ) { + if (_activeWorkId != event.workId || + state is! IndexingInProgress || + _isFinalizing) { + return; + } + _pdfTotalPages = event.total > 0 ? event.total : null; + _pdfPagesProcessed = event.total > 0 + ? event.processed.clamp(0, event.total) + : null; + _reemitProgressFlags(emit); + } } diff --git a/lib/indexing/bloc/indexing_event.dart b/lib/indexing/bloc/indexing_event.dart index 4f5a17a51e..eb918a5804 100644 --- a/lib/indexing/bloc/indexing_event.dart +++ b/lib/indexing/bloc/indexing_event.dart @@ -207,3 +207,14 @@ class UpdateIndexingProgress extends IndexingEvent { total, ]; } + +class UpdatePdfIndexingProgress extends IndexingEvent { + const UpdatePdfIndexingProgress(this.workId, this.processed, this.total); + + final int workId; + final int processed; + final int total; + + @override + List get props => [workId, processed, total]; +} diff --git a/lib/indexing/bloc/indexing_state.dart b/lib/indexing/bloc/indexing_state.dart index a5c376ecd7..a0380ddd5e 100644 --- a/lib/indexing/bloc/indexing_state.dart +++ b/lib/indexing/bloc/indexing_state.dart @@ -27,6 +27,8 @@ class IndexingInProgress extends IndexingState { this.isPaused = false, this.isEconomy = false, this.isFinalizing = false, + this.pdfPagesProcessed, + this.pdfTotalPages, }); /// שלב הבדיקה של ריצת אינדוקס — אילו ספרים מאונדקסים התיישנו. @@ -43,6 +45,9 @@ class IndexingInProgress extends IndexingState { /// אין לשלב זה התקדמות מדידה, ולכן המונה מוחלף בהודעה נפרדת. final bool isFinalizing; + final int? pdfPagesProcessed; + final int? pdfTotalPages; + @override List get props => [ ...super.props, @@ -50,6 +55,8 @@ class IndexingInProgress extends IndexingState { isPaused, isEconomy, isFinalizing, + pdfPagesProcessed, + pdfTotalPages, ]; } diff --git a/lib/indexing/indexing_work_status.dart b/lib/indexing/indexing_work_status.dart index 8dafc66f2b..3fbe03b75a 100644 --- a/lib/indexing/indexing_work_status.dart +++ b/lib/indexing/indexing_work_status.dart @@ -39,7 +39,10 @@ WorkStatusItem indexingWorkStatusItem( id: kIndexingWorkStatusId, title: 'אינדוקס ספרים', message: message, - detail: 'התקדמות: $processed/$total', + detail: state.pdfTotalPages != null && !state.isScanning + ? 'התקדמות: $processed/$total · חילוץ PDF ברקע: ' + '${state.pdfPagesProcessed}/${state.pdfTotalPages} עמודים' + : 'התקדמות: $processed/$total', progress: total > 0 ? (processed / total).clamp(0.0, 1.0) : null, onTap: onTap, actions: [ diff --git a/lib/indexing/models/indexing_resource_policy.dart b/lib/indexing/models/indexing_resource_policy.dart index 846905dcb5..98de6ab447 100644 --- a/lib/indexing/models/indexing_resource_policy.dart +++ b/lib/indexing/models/indexing_resource_policy.dart @@ -13,6 +13,17 @@ enum IndexingResourceMode { }; } +enum IndexingResourceReason { + explicitEconomy, + explicitNormal, + mobile, + lowCpu, + unknownRam, + lowRam, + lowAvailableRam, + normal, +} + class IndexingResourcePolicy { const IndexingResourcePolicy({ required this.cpuCount, @@ -26,15 +37,26 @@ class IndexingResourcePolicy { final int? totalRamMb; final int? availableRamMb; - bool useEconomy(IndexingResourceMode mode) => switch (mode) { - IndexingResourceMode.economy => true, - IndexingResourceMode.normal => false, - IndexingResourceMode.automatic => - mobile || - cpuCount <= 4 || - totalRamMb == null || - totalRamMb! <= 4096 || - (availableRamMb != null && availableRamMb! < 1024), + IndexingResourceReason reason(IndexingResourceMode mode) => switch (mode) { + IndexingResourceMode.economy => IndexingResourceReason.explicitEconomy, + IndexingResourceMode.normal => IndexingResourceReason.explicitNormal, + IndexingResourceMode.automatic when mobile => IndexingResourceReason.mobile, + IndexingResourceMode.automatic when cpuCount <= 4 => + IndexingResourceReason.lowCpu, + IndexingResourceMode.automatic when totalRamMb == null => + IndexingResourceReason.unknownRam, + IndexingResourceMode.automatic when totalRamMb! <= 4096 => + IndexingResourceReason.lowRam, + IndexingResourceMode.automatic + when availableRamMb != null && availableRamMb! < 1024 => + IndexingResourceReason.lowAvailableRam, + IndexingResourceMode.automatic => IndexingResourceReason.normal, + }; + + bool useEconomy(IndexingResourceMode mode) => switch (reason(mode)) { + IndexingResourceReason.explicitNormal || + IndexingResourceReason.normal => false, + _ => true, }; static IndexingResourcePolicy conservative() => IndexingResourcePolicy( diff --git a/lib/indexing/models/indexing_run_diagnostics.dart b/lib/indexing/models/indexing_run_diagnostics.dart new file mode 100644 index 0000000000..fa40146e46 --- /dev/null +++ b/lib/indexing/models/indexing_run_diagnostics.dart @@ -0,0 +1,119 @@ +import 'package:equatable/equatable.dart'; +import 'package:otzaria/indexing/models/indexing_resource_policy.dart'; + +enum IndexingStage { + preparation, + scan, + sourceLoading, + engine, + pdfExtraction, + commit, + optimize, +} + +enum IndexingCounter { + // כתיבות שהמנוע אישר; ביטול או התאוששות עשויים להסירן בהמשך. + documents, + pdfPages, + droppedPdfPages, + prefetchedPdfBooks, +} + +/// החלטת משאבים והדגימה שעליה היא מבוססת, ללא נתוני ספרים אישיים. +class IndexingResourceDecision extends Equatable { + IndexingResourceDecision(IndexingResourcePolicy policy, this.mode) + : reason = policy.reason(mode), + cpuCount = policy.cpuCount, + totalRamMb = policy.totalRamMb, + availableRamMb = policy.availableRamMb; + + final IndexingResourceMode mode; + final IndexingResourceReason reason; + final int cpuCount; + final int? totalRamMb; + final int? availableRamMb; + + @override + List get props => [ + mode, + reason, + cpuCount, + totalRamMb, + availableRamMb, + ]; +} + +/// זמני עבודה עשויים לחפוף בגלל חילוץ מוקדם; סכומם אינו זמן הריצה. +class IndexingRunDiagnostics extends Equatable { + IndexingRunDiagnostics({ + Map stageTimes = const {}, + Map counters = const {}, + List resourceDecisions = const [], + this.recoveryStarted = false, + }) : stageTimes = Map.unmodifiable(stageTimes), + counters = Map.unmodifiable(counters), + resourceDecisions = List.unmodifiable(resourceDecisions); + + final Map stageTimes; + final Map counters; + final List resourceDecisions; + final bool recoveryStarted; + + @override + List get props => [ + stageTimes, + counters, + resourceDecisions, + recoveryStarted, + ]; +} + +/// אוסף מקומי לריצה; תמונת מצב אינה משתנה כשעבודת רקע מסתיימת מאוחר. +class IndexingRunDiagnosticsCollector { + final _stageTimes = {}; + final _counters = {}; + final _resourceDecisions = []; + bool recoveryStarted = false; + + void addTime(IndexingStage stage, Duration elapsed) { + _stageTimes.update( + stage, + (value) => value + elapsed, + ifAbsent: () => elapsed, + ); + } + + Future measure(IndexingStage stage, Future Function() action) async { + final watch = Stopwatch()..start(); + try { + return await action(); + } finally { + addTime(stage, watch.elapsed); + } + } + + void increment(IndexingCounter counter, [int amount = 1]) { + _counters.update( + counter, + (value) => value + amount, + ifAbsent: () => amount, + ); + } + + void recordResources( + IndexingResourcePolicy policy, + IndexingResourceMode mode, + ) { + final decision = IndexingResourceDecision(policy, mode); + if (_resourceDecisions.isEmpty || _resourceDecisions.last != decision) { + _resourceDecisions.add(decision); + } + } + + IndexingRunDiagnostics snapshot() => IndexingRunDiagnostics( + stageTimes: _stageTimes, + counters: _counters, + resourceDecisions: _resourceDecisions, + recoveryStarted: recoveryStarted, + ); +} diff --git a/lib/indexing/models/indexing_run_result.dart b/lib/indexing/models/indexing_run_result.dart index b3ee40e4d5..4f7bb43524 100644 --- a/lib/indexing/models/indexing_run_result.dart +++ b/lib/indexing/models/indexing_run_result.dart @@ -1,4 +1,5 @@ import 'package:equatable/equatable.dart'; +import 'package:otzaria/indexing/models/indexing_run_diagnostics.dart'; enum IndexingFailureKind { partialPdf(isRetryable: false, preventedIndexing: false), @@ -51,6 +52,7 @@ class IndexingRunResult extends Equatable { required this.totalBooks, required this.indexedBooks, this.failures = const [], + this.diagnostics, }) : cancelled = false; const IndexingRunResult.cancelled({ @@ -58,6 +60,7 @@ class IndexingRunResult extends Equatable { required this.totalBooks, required this.indexedBooks, this.failures = const [], + this.diagnostics, }) : cancelled = true; final int processedBooks; @@ -65,6 +68,7 @@ class IndexingRunResult extends Equatable { final int indexedBooks; final bool cancelled; final List failures; + final IndexingRunDiagnostics? diagnostics; bool get completed => !cancelled; bool get isClean => completed && failures.isEmpty; @@ -85,5 +89,6 @@ class IndexingRunResult extends Equatable { indexedBooks, cancelled, failures, + diagnostics, ]; } diff --git a/lib/indexing/repository/indexing_repository.dart b/lib/indexing/repository/indexing_repository.dart index 65fadd5af3..d5b818e839 100644 --- a/lib/indexing/repository/indexing_repository.dart +++ b/lib/indexing/repository/indexing_repository.dart @@ -12,12 +12,14 @@ import 'package:otzaria/library/hidden/hidden_library_store.dart'; import 'package:otzaria/indexing/models/index_update_mode.dart'; import 'package:otzaria/indexing/models/pdf_index_setting.dart'; import 'package:otzaria/utils/file/disk_free_space.dart'; + import 'dart:async'; import 'dart:collection'; import 'dart:convert'; import 'dart:io'; import 'dart:isolate'; import 'dart:typed_data'; + import 'package:flutter/foundation.dart' hide Category; import 'package:otzaria/core/app_paths.dart'; import 'package:otzaria/core/info/personal_folders_info.dart'; @@ -40,6 +42,7 @@ import 'package:otzaria/indexing/models/index_check_scope.dart'; import 'package:otzaria/indexing/utils/book_source_hashes.dart'; import 'package:otzaria/indexing/models/index_commit_policy.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; +import 'package:otzaria/indexing/models/indexing_run_diagnostics.dart'; import 'package:otzaria/attached_libraries/models/attached_library.dart'; import 'package:otzaria/attached_libraries/repository/attached_library_registry.dart'; import 'package:otzaria/models/book_source.dart'; @@ -196,12 +199,16 @@ class IndexingRepository { } @visibleForTesting - Future prepareIndexingResources() async { + Future prepareIndexingResources([ + IndexingRunDiagnosticsCollector? diagnostics, + ]) async { _resources = await sampleResources(); - await _applyResourcePolicy(); + await _applyResourcePolicy(diagnostics); } - Future _applyResourcePolicy() async { + Future _applyResourcePolicy([ + IndexingRunDiagnosticsCollector? diagnostics, + ]) async { final resources = _resources; if (resources == null) return; final mode = IndexingResourceMode.fromStorage( @@ -215,6 +222,7 @@ class IndexingRepository { if (_tantivyDataProvider.isEconomyIndexing != economy) { await _tantivyDataProvider.setEconomyIndexing(economy); } + diagnostics?.recordResources(resources, mode); } Future _waitWhilePaused() async { @@ -537,6 +545,7 @@ class IndexingRepository { bool includePdfBooks = true, void Function(int processed, int total)? onScanProgress, void Function(int total)? onWorkListReady, + void Function(int processed, int total)? onPdfProgress, void Function()? onActualIndexingStarted, required void Function(int processed, int total) onProgress, void Function()? onFinalizing, @@ -549,10 +558,12 @@ class IndexingRepository { ); } final cancellationGeneration = _cancellationGeneration; + final diagnostics = IndexingRunDiagnosticsCollector(); _runStarted(); try { - return await _runIndexing( + final result = await _runIndexing( library, + diagnostics: diagnostics, cancellationGeneration: cancellationGeneration, books: books, changedBooks: changedBooks, @@ -560,10 +571,26 @@ class IndexingRepository { includePdfBooks: includePdfBooks, onScanProgress: onScanProgress, onWorkListReady: onWorkListReady, + onPdfProgress: onPdfProgress, onActualIndexingStarted: onActualIndexingStarted, onProgress: onProgress, onFinalizing: onFinalizing, ); + return result.cancelled + ? IndexingRunResult.cancelled( + processedBooks: result.processedBooks, + totalBooks: result.totalBooks, + indexedBooks: result.indexedBooks, + failures: result.failures, + diagnostics: diagnostics.snapshot(), + ) + : IndexingRunResult.completed( + processedBooks: result.processedBooks, + totalBooks: result.totalBooks, + indexedBooks: result.indexedBooks, + failures: result.failures, + diagnostics: diagnostics.snapshot(), + ); } finally { _runEnded(); } @@ -571,6 +598,7 @@ class IndexingRepository { Future _runIndexing( Library library, { + required IndexingRunDiagnosticsCollector diagnostics, required int cancellationGeneration, List? books, List changedBooks = const [], @@ -578,6 +606,7 @@ class IndexingRepository { bool includePdfBooks = true, void Function(int processed, int total)? onScanProgress, void Function(int total)? onWorkListReady, + void Function(int processed, int total)? onPdfProgress, void Function()? onActualIndexingStarted, required void Function(int processed, int total) onProgress, void Function()? onFinalizing, @@ -626,7 +655,10 @@ class IndexingRepository { ); } - await syncBookOrder(library); + await diagnostics.measure( + IndexingStage.preparation, + () => syncBookOrder(library), + ); final libraryBooks = wholeLibrary ? scope : eligible(library.getIndexableBooks()); @@ -760,14 +792,17 @@ class IndexingRepository { book, ]; final metadataChanged = {}; - final detected = await changeDetector.detectChanged( - candidates, - library: library, - isCancelled: () => !_tantivyDataProvider.isIndexing.value, - waitWhilePaused: _waitWhilePaused, - onMetadataOnlyChanged: (book) => - metadataChanged.add(BookIdentity.indexedFilePath(book)), - onProgress: onScanProgress, + final detected = await diagnostics.measure( + IndexingStage.scan, + () => changeDetector.detectChanged( + candidates, + library: library, + isCancelled: () => !_tantivyDataProvider.isIndexing.value, + waitWhilePaused: _waitWhilePaused, + onMetadataOnlyChanged: (book) => + metadataChanged.add(BookIdentity.indexedFilePath(book)), + onProgress: onScanProgress, + ), ); if (detected == null || !_tantivyDataProvider.isIndexing.value) { return IndexingRunResult.cancelled( @@ -818,7 +853,10 @@ class IndexingRepository { } final totalBooks = allBooks.length; final replacing = pending.isNotEmpty; - await prepareIndexingResources(); + await diagnostics.measure( + IndexingStage.preparation, + () => prepareIndexingResources(diagnostics), + ); if (!_tantivyDataProvider.isIndexing.value) { return IndexingRunResult.cancelled( processedBooks: 0, @@ -840,6 +878,7 @@ class IndexingRepository { : null, ); final canary = IndexingCrashCanary.current; + diagnostics.recoveryStarted = canary?.recovering ?? false; if (canary?.recovering ?? false) { // ספר שהוחלף נשאר באינדקס החתום בתוכנו הישן — אינו מעיד שלא קרס. canary!.forgetIndexed( @@ -848,17 +887,24 @@ class IndexingRepository { ); } prefetcher = PdfExtractionPrefetcher( - extract: extractPdfPagesGuarded, - maxInFlight: IndexingCrashCanary.current?.recovering ?? false - ? 0 - : PdfExtractionPrefetcher.defaultMaxInFlight, + extract: (book) => diagnostics.measure( + IndexingStage.pdfExtraction, + () => extractPdfPagesGuarded(book, onProgress: onPdfProgress), + ), + canPrefetch: () => !(canary?.recovering ?? false), + ); + final sourceHashes = await diagnostics.measure( + IndexingStage.preparation, + () => loadSourceHashes(allBooks), + ); + await diagnostics.measure( + IndexingStage.preparation, + () => Future.wait([ + GenerationCache.instance.warmUp(), + ReferenceBooksCache.instance.warmUp(), + BookFacetMetadataCache.instance.warmUp(), + ]), ); - final sourceHashes = await loadSourceHashes(allBooks); - await Future.wait([ - GenerationCache.instance.warmUp(), - ReferenceBooksCache.instance.warmUp(), - BookFacetMetadataCache.instance.warmUp(), - ]); final totalStopwatch = Stopwatch()..start(); final commitStopwatch = Stopwatch(); @@ -882,7 +928,7 @@ class IndexingRepository { cancelled = true; break; } - await _applyResourcePolicy(); + await _applyResourcePolicy(diagnostics); await _waitWhilePaused(); if (!_tantivyDataProvider.isIndexing.value) { cancelled = true; @@ -915,10 +961,12 @@ class IndexingRepository { } try { await _dropReplacedDocs(replaceKeys, [readyBook]); - final droppedPages = await _indexPdfBook( + final pdfResult = await _indexPdfBook( readyBook, + diagnostics: diagnostics, sourceHashes: sourceHashes, preExtracted: ready.extraction, + onPdfProgress: onPdfProgress, onActualIndexingStarted: onFirstActualIndexing, ); if (!_tantivyDataProvider.isIndexing.value) { @@ -928,10 +976,14 @@ class IndexingRepository { cancelled = true; break bookLoop; } - _recordPartialPdfFailure(readyBook, droppedPages, failures); + _recordPartialPdfFailure( + readyBook, + pdfResult.droppedPages, + failures, + ); _markWritten(BookIdentity.indexedFilePath(readyBook)); actuallyIndexed++; - commitPolicy.recordBook(); + commitPolicy.recordBook(docs: pdfResult.docs); } catch (e, stackTrace) { debugPrint('❌ שגיאה באינדוקס מוקדם של ${readyBook.title}: $e'); errors++; @@ -942,6 +994,7 @@ class IndexingRepository { failure, sourceHashes, failures, + diagnostics: diagnostics, replaceKeys: replaceKeys, ); if (handled) { @@ -976,6 +1029,7 @@ class IndexingRepository { allBooks, bookIndex, libraryBatches, + diagnostics: diagnostics, replaceKeys: replaceKeys, sourceHashes: sourceHashes, onActualIndexingStarted: onFirstActualIndexing, @@ -994,6 +1048,7 @@ class IndexingRepository { await _dropReplacedDocs(replaceKeys, [book]); final docs = await _indexTextBook( textBookForIndex, + diagnostics: diagnostics, sourceHashes: sourceHashes, onActualIndexingStarted: onFirstActualIndexing, ); @@ -1029,10 +1084,12 @@ class IndexingRepository { shouldPrefetch: shouldPrefetch, ); await _dropReplacedDocs(replaceKeys, [book]); - final droppedPages = await _indexPdfBook( + final pdfResult = await _indexPdfBook( book, + diagnostics: diagnostics, sourceHashes: sourceHashes, preExtracted: preExtracted, + onPdfProgress: onPdfProgress, onActualIndexingStarted: onFirstActualIndexing, ); if (!_tantivyDataProvider.isIndexing.value) { @@ -1040,10 +1097,10 @@ class IndexingRepository { cancelled = true; break; } - _recordPartialPdfFailure(book, droppedPages, failures); + _recordPartialPdfFailure(book, pdfResult.droppedPages, failures); _markWritten(BookIdentity.indexedFilePath(book)); actuallyIndexed++; - commitPolicy.recordBook(); + commitPolicy.recordBook(docs: pdfResult.docs); bookWasIndexed = true; } else { skipped++; @@ -1055,7 +1112,7 @@ class IndexingRepository { commitStopwatch ..reset() ..start(); - await _commitIndex(); + await _commitIndex(diagnostics); debugPrint( '💾 commit אחרי ${commitPolicy.pendingBooks} ספרים ' '(${commitPolicy.pendingDocs} מסמכים): ' @@ -1092,6 +1149,7 @@ class IndexingRepository { failure, sourceHashes, failures, + diagnostics: diagnostics, replaceKeys: replaceKeys, ); if (handled) { @@ -1125,12 +1183,15 @@ class IndexingRepository { commitStopwatch ..reset() ..start(); - final index = await _commitIndex(); + final index = await _commitIndex(diagnostics); debugPrint('💾 commit סופי: ${commitStopwatch.elapsedMilliseconds}ms'); await savePendingAfterCommit(); if (compact) { final optimizeStopwatch = Stopwatch()..start(); - await optimizeIndexBestEffort(index.optimize); + await diagnostics.measure( + IndexingStage.optimize, + () => optimizeIndexBestEffort(index.optimize), + ); debugPrint( '⚙️ optimize: ${optimizeStopwatch.elapsedMilliseconds}ms', ); @@ -1141,7 +1202,7 @@ class IndexingRepository { writeBufferDiscarded: writeBufferDiscarded, )) { // בלי commit בביטול, כל מה שאונדקס מאז ה-commit האחרון אבד. - await _commitIndex(); + await _commitIndex(diagnostics); debugPrint('💾 commit אחרי ביטול: ${commitPolicy.pendingBooks} ספרים'); await savePendingAfterCommit(); } @@ -1190,6 +1251,7 @@ class IndexingRepository { /// מחזיר את מספר המסמכים שנוספו (0 כשנכתב סמן ספר ריק). Future _indexTextBook( TextBook book, { + required IndexingRunDiagnosticsCollector diagnostics, required BookSourceHashes sourceHashes, void Function()? onActualIndexingStarted, }) async { @@ -1197,7 +1259,10 @@ class IndexingRepository { // גולמיים, בלי פענוח ל-String וקידוד חוזר על הגשר (~180ms/MB). await _beginBook(book); final loadStopwatch = Stopwatch()..start(); - final source = await loadTextBookSource(book); + final source = await diagnostics.measure( + IndexingStage.sourceLoading, + () => loadTextBookSource(book), + ); final bytes = source.bytes; final text = source.text; loadStopwatch.stop(); @@ -1231,17 +1296,26 @@ class IndexingRepository { ? source.dataUriLines : null; // קידוד String על גשר המנוע רץ על ה-UI isolate (337ms לספר של 18M תווים). - final payload = hasBytes ? bytes : await _utf8EncodeOffFrame(text!); - added = await engine.addTextBookBytes( - title: title, - topics: topics, - filePath: filePath, - text: payload, - sourceHash: _dbSourceHash(book, sourceHashes), - extraFacets: extraFacets, - textStorage: textStorage, - storedLines: storedLines, + final payload = hasBytes + ? bytes + : await diagnostics.measure( + IndexingStage.sourceLoading, + () => _utf8EncodeOffFrame(text!), + ); + added = await diagnostics.measure( + IndexingStage.engine, + () => engine.addTextBookBytes( + title: title, + topics: topics, + filePath: filePath, + text: payload, + sourceHash: _dbSourceHash(book, sourceHashes), + extraFacets: extraFacets, + textStorage: textStorage, + storedLines: storedLines, + ), ); + diagnostics.increment(IndexingCounter.documents, added); engineStopwatch.stop(); final size = hasBytes ? '${bytes.length} בייטים' @@ -1259,6 +1333,7 @@ class IndexingRepository { // אין תוכן ⇒ אין טביעת אצבע; במסלול המלא המנוע חותם אותה בעצמו. await _writeEmptyBookMarker( book, + diagnostics: diagnostics, sourceHashes: sourceHashes, ); } @@ -1331,6 +1406,7 @@ class IndexingRepository { List books, int start, _LibraryBatches batches, { + required IndexingRunDiagnosticsCollector diagnostics, required Set replaceKeys, required BookSourceHashes sourceHashes, void Function()? onActualIndexingStarted, @@ -1344,7 +1420,7 @@ class IndexingRepository { await _waitWhilePaused(); await yieldToIndexingForeground(); if (!_tantivyDataProvider.isIndexing.value) break; - await _applyResourcePolicy(); + await _applyResourcePolicy(diagnostics); await _waitWhilePaused(); if (!_tantivyDataProvider.isIndexing.value) break; final canary = IndexingCrashCanary.current; @@ -1417,6 +1493,7 @@ class IndexingRepository { } break; } finally { + diagnostics.addTime(IndexingStage.engine, stopwatch.elapsed); _libraryBatchToken = null; _tantivyDataProvider.isIndexing.removeListener(cancelOnStop); } @@ -1437,6 +1514,7 @@ class IndexingRepository { added.add(result.docs); indexedBooks++; docs += result.docs; + diagnostics.increment(IndexingCounter.documents, result.docs); case LibraryBookStatus.cancelled: cancelledBooks++; case LibraryBookStatus.missing || @@ -1458,14 +1536,29 @@ class IndexingRepository { return added; } - Future _indexPdfBook( + Future<({int docs, int droppedPages})> _indexPdfBook( PdfBook book, { + required IndexingRunDiagnosticsCollector diagnostics, required BookSourceHashes sourceHashes, void Function()? onActualIndexingStarted, Future? preExtracted, + void Function(int processed, int total)? onPdfProgress, }) async { // חילוץ מוקדם וישיר שומרים שגיאות בתוצאה; חסימת קריסה חלה גם על OCR. - final extracted = await (preExtracted ?? extractPdfPagesGuarded(book)); + final extracted = + await (preExtracted ?? + diagnostics.measure( + IndexingStage.pdfExtraction, + () => extractPdfPagesGuarded(book, onProgress: onPdfProgress), + )); + if (preExtracted != null) { + diagnostics.increment(IndexingCounter.prefetchedPdfBooks); + } + diagnostics.increment(IndexingCounter.pdfPages, extracted.pages.length); + diagnostics.increment( + IndexingCounter.droppedPdfPages, + extracted.droppedPages, + ); final pages = extracted.pages; final outline = extracted.outline; final openError = extracted.error; @@ -1482,7 +1575,7 @@ class IndexingRepository { 'ב-${extracted.extractMs}ms${preExtracted != null ? ' (prefetch)' : ''}', ); if (!_tantivyDataProvider.isIndexing.value) { - return extracted.droppedPages; + return (docs: 0, droppedPages: extracted.droppedPages); } // המנוע מכריע אם ל-PDF יש טקסט שמיש: addPdfBookBytes מנרמל, מסנן זבל @@ -1492,6 +1585,7 @@ class IndexingRepository { added = await _addPdfBookToEngine( book, pages, + diagnostics: diagnostics, sourceHashes: sourceHashes, onActualIndexingStarted: onActualIndexingStarted, ); @@ -1499,11 +1593,15 @@ class IndexingRepository { if (added == 0 && _tantivyDataProvider.isIndexing.value) { // אין שכבת טקסט שמישה (PDF סרוק) או שהפתיחה נכשלה — sidecar OCR. - final sidecarPages = await _loadPdfSidecar(book, outline); + final sidecarPages = await diagnostics.measure( + IndexingStage.sourceLoading, + () => _loadPdfSidecar(book, outline), + ); if (sidecarPages.isNotEmpty) { added = await _addPdfBookToEngine( book, sidecarPages, + diagnostics: diagnostics, sourceHashes: sourceHashes, onActualIndexingStarted: onActualIndexingStarted, ); @@ -1530,10 +1628,11 @@ class IndexingRepository { if (added == 0) { await _writeEmptyBookMarker( book, + diagnostics: diagnostics, sourceHashes: sourceHashes, ); } - return extracted.droppedPages; + return (docs: added == 0 ? 1 : added, droppedPages: extracted.droppedPages); } void _recordPartialPdfFailure( @@ -1557,27 +1656,35 @@ class IndexingRepository { Future _addPdfBookToEngine( PdfBook book, List<({String reference, String text, int pageIndex})> pages, { + required IndexingRunDiagnosticsCollector diagnostics, required BookSourceHashes sourceHashes, void Function()? onActualIndexingStarted, }) async { onActualIndexingStarted?.call(); // FRB מקודד ומפענח את הארגומנטים על ה-UI thread; רשימת עמודים גדולה הקפיאה // אותו (#3443). חוצץ בתים שנארז ב-isolate עובר כהעתקה אחת. - final packed = await _packPdfPagesOffFrame(pages); + final packed = await diagnostics.measure( + IndexingStage.sourceLoading, + () => _packPdfPagesOffFrame(pages), + ); if (!_tantivyDataProvider.isIndexing.value) { return 0; } final engine = await _tantivyDataProvider.engine; final engineStopwatch = Stopwatch()..start(); - final added = await engine.addPdfBookBytes( - title: book.title, - topics: _bookTopics(book), - filePath: BookIdentity.indexedFilePath(book), - extraFacets: _bookExtraFacets(book), - bytes: packed.bytes, - ends: packed.ends, - pageIndexes: packed.pageIndexes, + final added = await diagnostics.measure( + IndexingStage.engine, + () => engine.addPdfBookBytes( + title: book.title, + topics: _bookTopics(book), + filePath: BookIdentity.indexedFilePath(book), + extraFacets: _bookExtraFacets(book), + bytes: packed.bytes, + ends: packed.ends, + pageIndexes: packed.pageIndexes, + ), ); + diagnostics.increment(IndexingCounter.documents, added); engineStopwatch.stop(); debugPrint( '📄 "${book.title}": ${pages.length} עמודים → $added מסמכים | ' @@ -1620,6 +1727,7 @@ class IndexingRepository { /// הפעלה. בלי זה, מצב האינדוקס (שנקרא מהאינדקס) לעולם לא היה שלם. Future _writeEmptyBookMarker( Book book, { + IndexingRunDiagnosticsCollector? diagnostics, required BookSourceHashes sourceHashes, }) async { if (!_tantivyDataProvider.isIndexing.value) { @@ -1628,24 +1736,30 @@ class IndexingRepository { final index = await _tantivyDataProvider.engine; // add (ולא upsert): כל מסלולי הכתיבה מדלגים על ספר שכבר מאונדקס // (isBookIndexed), כך שהספר כאן תמיד חדש ואין מה למחוק. - await index.addDocumentsBatch( - docs: [ - DocumentInput( - ordinal: 0, - title: book.title, - reference: '', - topics: _bookTopics(book), - text: '', - segment: BigInt.zero, - isPdf: book is PdfBook, - filePath: BookIdentity.indexedFilePath(book), - extraFacets: _bookExtraFacets(book), - sourceHash: _dbSourceHash(book, sourceHashes), - // טביעת הטקסט הריק: כך ספר שנשאר ריק נמצא תואם בבדיקה הבאה. - textHash: await contentFingerprint(text: const []), - ), - ], - ); + final stopwatch = Stopwatch()..start(); + try { + await index.addDocumentsBatch( + docs: [ + DocumentInput( + ordinal: 0, + title: book.title, + reference: '', + topics: _bookTopics(book), + text: '', + segment: BigInt.zero, + isPdf: book is PdfBook, + filePath: BookIdentity.indexedFilePath(book), + extraFacets: _bookExtraFacets(book), + sourceHash: _dbSourceHash(book, sourceHashes), + // טביעת הטקסט הריק: כך ספר שנשאר ריק נמצא תואם בבדיקה הבאה. + textHash: await contentFingerprint(text: const []), + ), + ], + ); + diagnostics?.increment(IndexingCounter.documents); + } finally { + diagnostics?.addTime(IndexingStage.engine, stopwatch.elapsed); + } } /// כשל קבוע מקבל סמן ריק באינדקס, אחרת הספר "חסר" לנצח ומפעיל ריצת @@ -1655,6 +1769,7 @@ class IndexingRepository { IndexingFailure failure, BookSourceHashes sourceHashes, List failures, { + IndexingRunDiagnosticsCollector? diagnostics, Set replaceKeys = const {}, }) async { if (failure.isRetryable) return false; @@ -1664,6 +1779,7 @@ class IndexingRepository { await _dropReplacedDocs(replaceKeys, [book]); await _writeEmptyBookMarker( book, + diagnostics: diagnostics, sourceHashes: sourceHashes, ); } catch (error, stackTrace) { @@ -1750,13 +1866,16 @@ class IndexingRepository { /// נשמרת בתוצאה (הקורא מכריע בין sidecar להפצתה), ומשך החילוץ נמדד כאן — /// כך גם חילוץ שרץ מראש (prefetch) מדווח את זמנו האמיתי. @visibleForTesting - Future extractPdfPagesGuarded(PdfBook book) async { + Future extractPdfPagesGuarded( + PdfBook book, { + void Function(int processed, int total)? onProgress, + }) async { final stopwatch = Stopwatch()..start(); try { await _beginBook(book); // pdfium של האינדוקס ממתין בתור ה-worker לכל עבודה אחרת (הקורא קודם). final extracted = await Pdfrx.runAsBackgroundWork( - () => _extractPdfPages(book), + () => _extractPdfPages(book, onProgress: onProgress), ); return ( pages: extracted.pages, @@ -1775,6 +1894,8 @@ class IndexingRepository { extractMs: stopwatch.elapsedMilliseconds, droppedPages: 0, ); + } finally { + onProgress?.call(0, 0); } } @@ -1787,7 +1908,10 @@ class IndexingRepository { int droppedPages, }) > - _extractPdfPages(PdfBook book) async { + _extractPdfPages( + PdfBook book, { + void Function(int processed, int total)? onProgress, + }) async { const empty = ( pages: <({String reference, String text, int pageIndex})>[], outline: [], @@ -1816,6 +1940,7 @@ class IndexingRepository { final extracted = await extractPageTextsWithRetry( pageCount: document.pages.length, + onProgress: onProgress, loadPageText: (i) async { final text = await document.pages[i].loadText(); return text?.fullText; @@ -1867,10 +1992,22 @@ class IndexingRepository { required Future Function(int pageIndex) loadPageText, required Future Function() beforeEachPage, Duration pageTimeout = const Duration(seconds: 5), + void Function(int processed, int total)? onProgress, }) async { + final progressClock = Stopwatch()..start(); + void report(int processed, {bool force = false}) { + if (force || progressClock.elapsedMilliseconds >= 250) { + onProgress?.call(processed, pageCount); + progressClock.reset(); + } + } + + report(0, force: true); final pending = >{}; Future load(int index) async { - final future = pending[index] ??= loadPageText(index); + final future = pending[index] ??= loadPageText( + index, + ).then((text) => text); var timedOut = false; final text = await future.timeout( pageTimeout, @@ -1893,6 +2030,7 @@ class IndexingRepository { } else { texts[i] = text; } + if (i + 1 < pageCount) report(i + 1); } var droppedPages = 0; @@ -1910,6 +2048,7 @@ class IndexingRepository { texts[i] = text; } } + report(pageCount, force: true); return (texts: texts, droppedPages: droppedPages); } @@ -2308,9 +2447,16 @@ class IndexingRepository { } /// commit לאינדקס ורישום הספרים שנחתמו בקנרית הקריסות. - Future _commitIndex() async { + Future _commitIndex([ + IndexingRunDiagnosticsCollector? diagnostics, + ]) async { final index = await _tantivyDataProvider.engine; - await index.commit(); + final stopwatch = Stopwatch()..start(); + try { + await index.commit(); + } finally { + diagnostics?.addTime(IndexingStage.commit, stopwatch.elapsed); + } IndexingCrashCanary.current?.committed( _tantivyDataProvider.indexedFilePaths, ); diff --git a/lib/indexing/services/indexing_failure_reporter.dart b/lib/indexing/services/indexing_failure_reporter.dart index 57ac81c255..71ad42d84d 100644 --- a/lib/indexing/services/indexing_failure_reporter.dart +++ b/lib/indexing/services/indexing_failure_reporter.dart @@ -5,10 +5,6 @@ import 'package:otzaria/core/startup_timeline.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; /// רושם ל-errors.txt סיכום של ריצת אינדוקס שכשלה בחלקה, או שנמשכה זמן רב. -/// -/// ריצה נקייה וקצרה אינה נרשמת. ריצה נקייה שחרגה מסף העלייה האיטית כן — -/// אינדוקס מלא אחרי עדכון ספרייה מקפיא את התוכנה לדקות ומדווח כ"לא נפתחת" -/// (issue #1192), ובלי הרשומה אין דרך להבדיל בינו לעלייה איטית באמת. class IndexingFailureReporter { const IndexingFailureReporter._(); @@ -74,6 +70,24 @@ class IndexingFailureReporter { ..writeln('Warnings: ${result.warningCount}'); final memoryLine = formatMemoryLine(memory ?? memoryInfo()); if (memoryLine.isNotEmpty) buffer.writeln('Memory: $memoryLine'); + final diagnostics = result.diagnostics; + if (diagnostics != null) { + buffer.writeln('Recovery at start: ${diagnostics.recoveryStarted}'); + buffer.writeln('Work times (overlapping stages; not additive):'); + for (final entry in diagnostics.stageTimes.entries) { + buffer.writeln(' ${entry.key.name}: ${entry.value.inMicroseconds}us'); + } + for (final entry in diagnostics.counters.entries) { + buffer.writeln('${entry.key.name}: ${entry.value}'); + } + for (final decision in diagnostics.resourceDecisions) { + buffer.writeln( + 'Resources: mode=${decision.mode.name} reason=${decision.reason.name} ' + 'cpu=${decision.cpuCount} totalRamMb=${decision.totalRamMb} ' + 'availableRamMb=${decision.availableRamMb}', + ); + } + } for (var i = 0; i < result.failures.length; i++) { final failure = result.failures[i]; diff --git a/lib/indexing/utils/indexing_crash_canary.dart b/lib/indexing/utils/indexing_crash_canary.dart index aba3aec8f8..1d7636ae4f 100644 --- a/lib/indexing/utils/indexing_crash_canary.dart +++ b/lib/indexing/utils/indexing_crash_canary.dart @@ -14,7 +14,9 @@ class IndexingCrashedBefore implements Exception { /// מוני קריסות של ספרים שבאינדוקס וחסימות שטרם נחתמו באינדקס. class IndexingCrashCanary { - IndexingCrashCanary._(this._file) : _attempts = _read(_file); + IndexingCrashCanary._(this._file) : _attempts = _read(_file) { + _recoveryKeys.addAll(_attempts.keys); + } /// הריצה הפעילה; סגירה מסודרת של התוכנה מסיימת אותה ([finish]). static IndexingCrashCanary? current; @@ -43,6 +45,7 @@ class IndexingCrashCanary { final File _file; final Map _attempts; + final Set _recoveryKeys = {}; final Set _inFlight = {}; final Set _skipped = {}; RandomAccessFile? _raf; @@ -50,7 +53,7 @@ class IndexingCrashCanary { bool _dirty = false; /// ריצה קודמת מתה באמצע: מאנדקסים ספר-ספר, כדי שרק האשם ייספר. - bool get recovering => _attempts.isNotEmpty; + bool get recovering => _attempts.keys.any(_recoveryKeys.contains); static Map _read(File file) { try { diff --git a/lib/indexing/utils/pdf_extraction_prefetcher.dart b/lib/indexing/utils/pdf_extraction_prefetcher.dart index cd3554ff6e..b864699b32 100644 --- a/lib/indexing/utils/pdf_extraction_prefetcher.dart +++ b/lib/indexing/utils/pdf_extraction_prefetcher.dart @@ -48,6 +48,7 @@ class PdfExtractionPrefetcher { this.maxInFlight = defaultMaxInFlight, this.maxPendingChars = defaultMaxPendingChars, this.maxInFlightBytes = defaultMaxInFlightBytes, + this.canPrefetch, @visibleForTesting Future Function(String path)? fileSizeOf, }) : _fileSizeOf = fileSizeOf ?? _statFileSize; @@ -67,6 +68,7 @@ class PdfExtractionPrefetcher { final int maxInFlight; final int maxPendingChars; final int maxInFlightBytes; + final bool Function()? canPrefetch; final Future Function(String path) _fileSizeOf; final List<_PrefetchSlot> _slots = []; @@ -158,6 +160,7 @@ class PdfExtractionPrefetcher { } bool get _hasCapacity { + if (canPrefetch?.call() == false) return false; if (_slots.length >= maxInFlight) return false; // ספר יחיד החורג מהתקרות מוזנק בכל זאת, אחרת התור נתקע ריק לנצח. if (_slots.isEmpty) return true; diff --git a/lib/migration/services/external_book_import.dart b/lib/migration/services/external_book_import.dart index 5fb4106393..e0b7634e16 100644 --- a/lib/migration/services/external_book_import.dart +++ b/lib/migration/services/external_book_import.dart @@ -7,6 +7,7 @@ import 'package:otzaria/migration/models/category.dart'; import 'package:otzaria/migration/models/topic.dart'; import 'package:otzaria/models/books.dart' as reader; import 'package:otzaria/utils/file/document_converter.dart'; +import 'package:otzaria/utils/file/docx_cache.dart'; import 'package:otzaria/utils/file/document_format.dart'; import 'package:otzaria/utils/file/toc_parser.dart'; import 'package:path/path.dart' as path; @@ -46,7 +47,14 @@ class PreparedExternalBook { tocEntries: format.isTextual ? externalBookTocEntries( TocParser.parseEntriesFromContent( - await convertDocumentFile(filePath, embedImages: false), + canCacheImportedDocument(stat.size) && + format.supportsImageFreeConversion + ? await convertDocumentForIndex( + File(filePath), + path.basenameWithoutExtension(filePath), + format, + ) + : await convertDocumentFile(filePath, embedImages: false), ), ) : null, @@ -114,7 +122,7 @@ Future prepareExternalBookInIsolate( FileStat stat, DocumentFormat format, ) async { - if (!format.isTextual) { + if (!format.isTextual || hasImportConversionCache) { return PreparedExternalBook.prepare(filePath, stat, format); } return Isolate.run( diff --git a/lib/migration/sync/background_db_sync_worker.dart b/lib/migration/sync/background_db_sync_worker.dart index c84111fb59..44532b2b19 100644 --- a/lib/migration/sync/background_db_sync_worker.dart +++ b/lib/migration/sync/background_db_sync_worker.dart @@ -1,3 +1,5 @@ +import '../../utils/file/docx_cache.dart'; + import 'dart:async'; import 'dart:isolate'; @@ -54,7 +56,9 @@ Future runCustomFoldersDbSyncInIsolate({ // (קריאות dedup בלבד), ולכן החיבור הראשי אינו נסגר. return DatabaseLibraryProvider.operationQueue.enqueue(() async { await QueryLoader.initialize(); - final resultMap = await _runWorkerIsolate(buildPayload(), isDelete: false); + final payload = buildPayload() + ..['cachePath'] = await resolveImportConversionCachePath(); + final resultMap = await _runWorkerIsolate(payload, isDelete: false); return _resultFromMap(resultMap); }); } @@ -292,7 +296,10 @@ Future _withWorkerSyncService( ); try { - return await body(service); + final cachePath = payload['cachePath'] as String?; + return cachePath == null + ? await body(service) + : await withImportConversionCache(cachePath, () => body(service)); } finally { lineWriter.dispose(); database.close(); diff --git a/lib/utils/file/docx_cache.dart b/lib/utils/file/docx_cache.dart index ef1e0947cb..2b5cbeda22 100644 --- a/lib/utils/file/docx_cache.dart +++ b/lib/utils/file/docx_cache.dart @@ -6,6 +6,8 @@ import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:otzaria/data/data_providers/cache_database_holder.dart'; import 'package:otzaria/migration/models/docx_text_cache_entry.dart'; +import 'package:otzaria/migration/database/daos/database.dart'; +import 'package:otzaria/migration/database/repository/seforim_repository.dart'; import 'package:otzaria/utils/file/docx_to_otzaria.dart'; import 'package:otzaria/utils/text/html_escape.dart'; import 'package:otzaria/utils/file/document_format.dart'; @@ -34,7 +36,80 @@ bool _shouldOpportunisticPrune() => _pruneSampler.nextInt(20) == 0; /// המרות פעילות לפי קובץ, גרסת ממיר ווריאנט פלט; מונע עבודה כפולה מקבילה /// לפני שהמטמון נכתב. -final Map> _inFlight = {}; +final Map> _inFlight = {}; + +final Object _importCacheKey = Object(); + +bool get hasImportConversionCache => Zone.current[_importCacheKey] != null; + +bool canCacheImportedDocument(int sourceBytes) { + final scope = Zone.current[_importCacheKey] as _ImportConversionCache?; + return scope != null && sourceBytes >= scope.minimumSourceBytes; +} + +Future resolveImportConversionCachePath() async { + try { + return await CacheDatabaseHolder.resolveDbPath(); + } catch (error) { + debugPrint('Document import cache unavailable: $error'); + return null; + } +} + +/// משתפת את מטמון ההמרה עם worker של ייבוא בנתיב שנפתר מראש. +Future withImportConversionCache( + String? databasePath, + Future Function() body, { + // במסמך זעיר פתיחת המטמון יקרה יותר מהמרה חוזרת באינדוקס. + int minimumSourceBytes = 8 * 1024, +}) async { + if (databasePath == null) return body(); + final scope = _ImportConversionCache(databasePath, minimumSourceBytes); + try { + return await runZoned(body, zoneValues: {_importCacheKey: scope}); + } finally { + await scope.close(); + } +} + +class _ImportConversionCache { + _ImportConversionCache(this.path, this.minimumSourceBytes); + + final String path; + final int minimumSourceBytes; + MyDatabase? database; + Future? _repository; + + Future get repository => _repository ??= _open(); + + Future _open() async { + final db = database = MyDatabase.withPath(path); + final repository = SeforimRepository(db); + await repository.ensureInitialized(); + return repository; + } + + Future close() async { + try { + await database?.backgroundWritesDone; + await database?.closeInBackground(); + } catch (error) { + debugPrint('Document import cache close failed: $error'); + } + } +} + +Future _finishCacheMaintenance(Future operation) async { + if (hasImportConversionCache) { + await operation; + } else { + unawaited(operation); + } +} + +Future _conversionCacheRepository() => + (Zone.current[_importCacheKey] as _ImportConversionCache?)?.repository ?? + CacheDatabaseHolder.instance.repository; /// ממיר מסמך Word מבוסס OOXML (DOCX/DOCM/DOTX/DOTM) לטקסט של אוצריא, עם /// מטמון מתמשך ב-`cache.db`. @@ -209,18 +284,18 @@ Future _convertWithCache( // ── נתיב cache-hit ────────────────────────────────────────────────────── try { - final repo = await CacheDatabaseHolder.instance.repository; + final repo = await _conversionCacheRepository(); final entry = await repo.getDocxTextCacheEntry(cachePath); if (entry != null && entry.isValidFor(size, mtime, converterVersion)) { final now = DateTime.now().millisecondsSinceEpoch; // throttle: touch לכל היותר פעם ביום (מונע כתיבת WAL בכל פתיחה). if (now - entry.accessedAt > _touchThrottleMs) { - unawaited( + await _finishCacheMaintenance( repo.touchDocxTextCacheEntry(cachePath, now).catchError((_) {}), ); } if (_shouldOpportunisticPrune()) { - unawaited( + await _finishCacheMaintenance( repo .pruneDocxTextCacheAccessedBefore( now - _conversionCacheTtl.inMilliseconds, @@ -236,7 +311,13 @@ Future _convertWithCache( // ── נתיב המרה ────────────────────────────────────────────────────────── // דה-דופ המרות מקבילות: אם כבר רצה המרה לאותו קובץ, נצרף אליה. - final key = '$cachePath|$size|$mtime|$converterVersion'; + final key = ( + Zone.current[_importCacheKey], + cachePath, + size, + mtime, + converterVersion, + ); final pending = _inFlight[key]; if (pending != null) { return _withFreshTitle(await pending, title); @@ -253,15 +334,18 @@ Future _convertWithCache( } // השמירה ב-isolate נמשכת שניות; עד סופה פתיחה נוספת מקבלת את הטקסט מכאן. - unawaited( - _persist( - cachePath, - size, - mtime, - converterVersion, - text, - ).whenComplete(() => _inFlight.remove(key)), - ); + final persistence = _persist( + cachePath, + size, + mtime, + converterVersion, + text, + ).whenComplete(() => _inFlight.remove(key)); + if (hasImportConversionCache) { + await persistence; + } else { + unawaited(persistence); + } return text; } @@ -288,7 +372,7 @@ Future _persist( String text, ) async { try { - final repo = await CacheDatabaseHolder.instance.repository; + final repo = await _conversionCacheRepository(); final now = DateTime.now().millisecondsSinceEpoch; await repo.upsertDocxTextCacheEntry( DocxTextCacheEntry( diff --git a/test/indexing/bloc/indexing_bloc_test.dart b/test/indexing/bloc/indexing_bloc_test.dart index 987bc56990..9df5f0a1d6 100644 --- a/test/indexing/bloc/indexing_bloc_test.dart +++ b/test/indexing/bloc/indexing_bloc_test.dart @@ -42,6 +42,36 @@ void main() { _FakeIndexingRepository repositoryOf(IndexingBloc bloc) => (bloc as _FakeIndexingBloc).repository; + test('חיווי עמודי PDF נשמר בהשהיה ומתעלם מאירוע אחרי ביטול', () async { + final repository = _FakeIndexingRepository()..pdfGate = Completer(); + final bloc = _FakeIndexingBloc(repository); + final settled = Completer(); + bloc.add(StartIndexing(libraryWithBooks(), onSettled: settled.complete)); + await repository.pdfReady.future; + await pumpEventQueue(); + final report = repository.reportPdfProgress!; + final progress = bloc.stream.firstWhere( + (state) => state is IndexingInProgress && state.pdfPagesProcessed == 23, + ); + report(23, 120); + final displayed = await progress as IndexingInProgress; + expect(displayed.pdfTotalPages, 120); + final paused = bloc.stream.firstWhere( + (state) => state is IndexingInProgress && state.isPaused, + ); + bloc.add(PauseIndexing()); + expect((await paused as IndexingInProgress).pdfPagesProcessed, 23); + final stopped = bloc.stream.firstWhere((state) => state is IndexingStopped); + bloc.add(CancelIndexing()); + await stopped; + report(99, 120); + await pumpEventQueue(); + expect(bloc.state, isA()); + repository.pdfGate!.complete(); + await settled.future; + await bloc.close(); + }); + group('מקום פנוי בכונן האינדקס', () { const mb = 1024 * 1024; @@ -1341,6 +1371,9 @@ class _FakeIndexingRepository extends IndexingRepository { /// כשהוא מסופק — כל ריצה ממתינה לו לפני שהיא מתחילה. Completer? runGate; + Completer? pdfGate; + final pdfReady = Completer(); + void Function(int, int)? reportPdfProgress; int dropOrphanedCalls = 0; final compactionRequests = []; int dropHiddenCalls = 0; @@ -1386,6 +1419,7 @@ class _FakeIndexingRepository extends IndexingRepository { bool includePdfBooks = true, void Function(int processed, int total)? onScanProgress, void Function(int total)? onWorkListReady, + void Function(int processed, int total)? onPdfProgress, void Function()? onActualIndexingStarted, required void Function(int processed, int total) onProgress, void Function()? onFinalizing, @@ -1400,6 +1434,10 @@ class _FakeIndexingRepository extends IndexingRepository { ? 0 : (books ?? library.getIndexableBooks()).length + changedBooks.length; if (total > 0) onWorkListReady?.call(total); + reportPdfProgress = onPdfProgress; + if (!pdfReady.isCompleted) pdfReady.complete(); + final pdfWait = pdfGate; + if (pdfWait != null) await pdfWait.future; final gate = finalizeGate; final IndexingRunResult runResult; if (gate != null) { diff --git a/test/indexing/bloc/indexing_state_test.dart b/test/indexing/bloc/indexing_state_test.dart index 70016db93f..7304f720b2 100644 --- a/test/indexing/bloc/indexing_state_test.dart +++ b/test/indexing/bloc/indexing_state_test.dart @@ -4,6 +4,11 @@ import 'package:otzaria/indexing/bloc/indexing_state.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; void main() { + test('התקדמות בתוך PDF משתתפת בשוויון המצב', () { + const before = IndexingInProgress(pdfPagesProcessed: 1, pdfTotalPages: 100); + const after = IndexingInProgress(pdfPagesProcessed: 2, pdfTotalPages: 100); + expect(before, isNot(after)); + }); const failure = IndexingFailure( bookTitle: 'ספר', bookPath: 'ext:42', diff --git a/test/indexing/indexing_work_status_test.dart b/test/indexing/indexing_work_status_test.dart index 359409be2d..87f2a432a8 100644 --- a/test/indexing/indexing_work_status_test.dart +++ b/test/indexing/indexing_work_status_test.dart @@ -4,6 +4,20 @@ import 'package:otzaria/indexing/indexing_work_status.dart'; void main() { group('indexingWorkStatusItem', () { + test('חיווי PDF מציג עמודים בלי להחליף את התקדמות הספרים', () { + final item = indexingWorkStatusItem( + const IndexingInProgress( + booksProcessed: 7, + totalBooks: 12, + pdfPagesProcessed: 23, + pdfTotalPages: 120, + ), + onTogglePause: () {}, + onToggleEconomy: () {}, + ); + expect(item.detail, 'התקדמות: 7/12 · חילוץ PDF ברקע: 23/120 עמודים'); + expect(item.progress, closeTo(7 / 12, 0.001)); + }); const running = IndexingInProgress( booksProcessed: 25, totalBooks: 100, diff --git a/test/indexing/models/indexing_resource_policy_test.dart b/test/indexing/models/indexing_resource_policy_test.dart index 97d9ee9a44..759063a74a 100644 --- a/test/indexing/models/indexing_resource_policy_test.dart +++ b/test/indexing/models/indexing_resource_policy_test.dart @@ -2,6 +2,68 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/indexing/models/indexing_resource_policy.dart'; void main() { + test( + 'decision reasons preserve thresholds and explicit preference precedence', + () { + final cases = <(IndexingResourcePolicy, IndexingResourceReason)>[ + ( + const IndexingResourcePolicy(cpuCount: 8, mobile: true), + IndexingResourceReason.mobile, + ), + ( + const IndexingResourcePolicy(cpuCount: 4, mobile: false), + IndexingResourceReason.lowCpu, + ), + ( + const IndexingResourcePolicy(cpuCount: 5, mobile: false), + IndexingResourceReason.unknownRam, + ), + ( + const IndexingResourcePolicy( + cpuCount: 5, + mobile: false, + totalRamMb: 4096, + ), + IndexingResourceReason.lowRam, + ), + ( + const IndexingResourcePolicy( + cpuCount: 5, + mobile: false, + totalRamMb: 4097, + availableRamMb: 1023, + ), + IndexingResourceReason.lowAvailableRam, + ), + ( + const IndexingResourcePolicy( + cpuCount: 5, + mobile: false, + totalRamMb: 4097, + availableRamMb: 1024, + ), + IndexingResourceReason.normal, + ), + ]; + for (final (policy, reason) in cases) { + expect(policy.reason(IndexingResourceMode.automatic), reason); + expect( + policy.useEconomy(IndexingResourceMode.automatic), + reason != IndexingResourceReason.normal, + ); + expect( + policy.reason(IndexingResourceMode.normal), + IndexingResourceReason.explicitNormal, + ); + expect(policy.useEconomy(IndexingResourceMode.normal), isFalse); + expect( + policy.reason(IndexingResourceMode.economy), + IndexingResourceReason.explicitEconomy, + ); + expect(policy.useEconomy(IndexingResourceMode.economy), isTrue); + } + }, + ); test( 'automatic policy considers CPU, RAM, available memory and platform', () { diff --git a/test/indexing/models/indexing_run_diagnostics_test.dart b/test/indexing/models/indexing_run_diagnostics_test.dart new file mode 100644 index 0000000000..a31a8cad5d --- /dev/null +++ b/test/indexing/models/indexing_run_diagnostics_test.dart @@ -0,0 +1,87 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:otzaria/indexing/models/indexing_resource_policy.dart'; +import 'package:otzaria/indexing/models/indexing_run_diagnostics.dart'; +import 'package:otzaria/indexing/models/indexing_run_result.dart'; + +void main() { + const policy = IndexingResourcePolicy( + cpuCount: 8, + mobile: false, + totalRamMb: 16000, + availableRamMb: 6000, + ); + + test('snapshots retain their values when late background work finishes', () { + final collector = IndexingRunDiagnosticsCollector() + ..recoveryStarted = true + ..addTime(IndexingStage.engine, const Duration(microseconds: 1500)) + ..increment(IndexingCounter.documents, 20) + ..recordResources(policy, IndexingResourceMode.automatic); + final first = collector.snapshot(); + collector + ..addTime(IndexingStage.engine, const Duration(microseconds: 500)) + ..increment(IndexingCounter.documents, 3) + ..recordResources(policy, IndexingResourceMode.economy); + final last = collector.snapshot(); + expect(first.stageTimes[IndexingStage.engine]!.inMicroseconds, 1500); + expect(first.counters[IndexingCounter.documents], 20); + expect(first.resourceDecisions, hasLength(1)); + expect(last.stageTimes[IndexingStage.engine]!.inMicroseconds, 2000); + expect(last.counters[IndexingCounter.documents], 23); + expect(last.resourceDecisions, hasLength(2)); + expect(first.recoveryStarted, isTrue); + expect(() => first.counters.clear(), throwsUnsupportedError); + expect(() => first.stageTimes.clear(), throwsUnsupportedError); + expect(() => first.resourceDecisions.clear(), throwsUnsupportedError); + }); + + test( + 'resource decisions suppress repeated samples but retain mode changes', + () { + final collector = IndexingRunDiagnosticsCollector() + ..recordResources(policy, IndexingResourceMode.automatic) + ..recordResources(policy, IndexingResourceMode.automatic) + ..recordResources(policy, IndexingResourceMode.normal) + ..recordResources(policy, IndexingResourceMode.automatic); + expect(collector.snapshot().resourceDecisions, hasLength(3)); + expect(IndexingRunDiagnosticsCollector().snapshot().counters, isEmpty); + }, + ); + + test( + 'a failed measured operation keeps its elapsed work and original error', + () async { + final collector = IndexingRunDiagnosticsCollector(); + final error = StateError('source failure'); + await expectLater( + collector.measure(IndexingStage.sourceLoading, () async { + throw error; + }), + throwsA(same(error)), + ); + expect( + collector.snapshot().stageTimes, + contains(IndexingStage.sourceLoading), + ); + expect(await collector.measure(IndexingStage.engine, () async => 42), 42); + }, + ); + + test( + 'cancelled results preserve diagnostics and include them in equality', + () { + IndexingRunResult result(int docs) => IndexingRunResult.cancelled( + processedBooks: 1, + totalBooks: 3, + indexedBooks: 1, + diagnostics: IndexingRunDiagnostics( + counters: {IndexingCounter.documents: docs}, + ), + ); + expect(result(3), result(3)); + expect(result(3), isNot(result(4))); + expect(result(3).diagnostics!.counters[IndexingCounter.documents], 3); + expect(result(3).completed, isFalse); + }, + ); +} diff --git a/test/indexing/repository/indexing_repository_test.dart b/test/indexing/repository/indexing_repository_test.dart index a178ac5f83..3fc9b0e9b8 100644 --- a/test/indexing/repository/indexing_repository_test.dart +++ b/test/indexing/repository/indexing_repository_test.dart @@ -1,4 +1,5 @@ import 'package:otzaria/data/book_identity.dart'; + import 'dart:async'; import 'dart:convert'; import 'dart:io' as io; @@ -23,6 +24,7 @@ import 'package:otzaria/find_ref/repository/find_ref_db_isolate.dart'; import 'package:otzaria/migration/database/daos/database.dart'; import 'package:otzaria/migration/database/repository/seforim_repository.dart'; import 'package:otzaria/settings/engine/settings_repository.dart'; + import '../../test_helpers/memory_cache_provider.dart'; import '../../support/fake_line_source_engine.dart'; @@ -35,6 +37,8 @@ import 'package:otzaria/indexing/models/index_check_scope.dart'; import 'package:otzaria/indexing/models/index_commit_policy.dart'; import 'package:otzaria/indexing/models/index_update_mode.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; +import 'package:otzaria/indexing/models/indexing_run_diagnostics.dart'; +import 'package:otzaria/indexing/repository/index_change_detector.dart'; import 'package:otzaria/indexing/repository/indexing_repository.dart'; import 'package:otzaria/indexing/utils/indexing_crash_canary.dart'; import 'package:otzaria/indexing/utils/pdf_extraction_prefetcher.dart'; @@ -82,6 +86,80 @@ void main() { IndexingCrashCanary.writeLog = ErrorLogFile.appendText; IndexingRepository.contentFingerprint = computeContentFingerprintBytes; }); + group('אבחון ריצות אינדוקס', () { + test('שתי ריצות שומרות תמונות מצב נפרדות ושלבי עבודה', () async { + final provider = _RecordingTantivyDataProvider(_RecordingSearchEngine()); + final repository = _FakeExtractionRepository(provider); + final pdf = PdfBook(title: 'ראשון', path: 'first.pdf'); + final text = TextBook(id: 62187, title: 'שני'); + final library = Library(categories: [])..books.addAll([pdf, text]); + final first = await repository.runIndexing( + library, + books: [pdf], + onProgress: (_, _) {}, + ); + final firstDiagnostics = first.diagnostics!; + expect(firstDiagnostics.counters[IndexingCounter.pdfPages], 1); + expect( + firstDiagnostics.counters[IndexingCounter.documents], + greaterThan(0), + ); + expect( + firstDiagnostics.stageTimes, + contains(IndexingStage.pdfExtraction), + ); + expect(firstDiagnostics.stageTimes, contains(IndexingStage.engine)); + expect(firstDiagnostics.stageTimes, contains(IndexingStage.commit)); + final second = await repository.runIndexing( + library, + books: [text], + onProgress: (_, _) {}, + ); + expect(second.diagnostics!.counters[IndexingCounter.pdfPages], isNull); + expect( + second.diagnostics!.stageTimes, + contains(IndexingStage.sourceLoading), + ); + expect(firstDiagnostics.counters[IndexingCounter.pdfPages], 1); + expect(firstDiagnostics, isNot(same(second.diagnostics))); + }); + + test('ביטול בזמן טעינת ספר שומר אבחון בלי כתיבת מסמכים', () async { + final provider = _RecordingTantivyDataProvider(_RecordingSearchEngine()); + final repository = _CancelDuringLoadRepository(provider); + final book = TextBook(id: 62188, title: 'ביטול'); + final result = await repository.runIndexing( + Library(categories: [])..books.add(book), + books: [book], + onProgress: (_, _) {}, + ); + expect(result.cancelled, isTrue); + expect( + result.diagnostics!.stageTimes, + contains(IndexingStage.sourceLoading), + ); + expect(result.diagnostics!.counters[IndexingCounter.documents], isNull); + }); + + test('סריקה ללא שינוי שומרת זמן בדיקה בלי משאבי כתיבה', () async { + final provider = _RecordingTantivyDataProvider(_RecordingSearchEngine()); + final repository = _FakeExtractionRepository(provider) + ..changeDetector = _EmptyDiagnosticsChangeDetector(); + final book = TextBook(id: 62189, title: 'תואם'); + provider.indexedFilePaths.add(BookIdentity.indexedFilePath(book)); + final result = await repository.runIndexing( + Library(categories: [])..books.add(book), + books: const [], + check: IndexCheckScope.library, + onProgress: (_, _) {}, + ); + expect(result.completed, isTrue); + expect(result.indexedBooks, 0); + expect(result.diagnostics!.stageTimes, contains(IndexingStage.scan)); + expect(result.diagnostics!.counters, isEmpty); + expect(result.diagnostics!.resourceDecisions, isEmpty); + }); + }); group('הסתרות ואינדקס מלא', () { test('סטטוס כולל מהדורה גלויה מחוץ לעץ ומחריג קטגוריה מוסתרת', () async { final library = Library(categories: []); @@ -3084,6 +3162,60 @@ void main() { expect(provider.indexedFilePaths, {r'C:\missing\א.pdf'}); }); + test('PDF נספר בסף המסמכים לשמירת ביניים', () async { + IndexingRepository.newCommitPolicy = () => IndexCommitPolicy(maxDocs: 1); + addTearDown( + () => IndexingRepository.newCommitPolicy = IndexCommitPolicy.new, + ); + final engine = _RecordingSearchEngine(); + final provider = _RecordingTantivyDataProvider(engine); + final books = [ + for (var i = 0; i < 2; i++) PdfBook(title: 'p$i', path: 'C:\\p$i.pdf'), + ]; + final library = Library(categories: [])..books.addAll(books); + final commits = >[]; + engine.onCommit = () => commits.add([...engine.addedPdfTitles]); + final result = await _FakeExtractionRepository(provider) + .indexAllBooks(library, onProgress: (_, _) {}); + expect(result.isClean, isTrue); + expect(commits.first, ['p0']); + expect(commits.last, ['p0', 'p1']); + expect(provider.indexedFilePaths, books.map((b) => b.path).toSet()); + }); + + test('התאוששות PDF מחזירה חפיפה לאחר סיום החשוד', () async { + final temp = await io.Directory.systemTemp.createTemp('pdf_recovery_'); + addTearDown(() => temp.delete(recursive: true)); + final engine = _RecordingSearchEngine(); + final provider = _RecordingTantivyDataProvider(engine) + ..activeIndexPath = '${temp.path}/index'; + final books = [ + for (var i = 0; i < 3; i++) PdfBook(title: 'p$i', path: 'C:\\p$i.pdf'), + ]; + io.File('${provider.activeIndexPath}.in_flight.json') + .writeAsStringSync(jsonEncode({books.first.path: 1})); + final repository = _CanaryExtractionRepository(provider); + final extractedDuringWrite = >{}; + engine.onPdfAdded = (title) => + extractedDuringWrite[title] = [...repository.extractedTitles]; + final result = await repository.indexAllBooks( + Library(categories: [])..books.addAll(books), + onProgress: (_, _) {}, + ); + expect(result.isClean, isTrue); + expect(extractedDuringWrite['p0'], [ + 'p0', + ], reason: 'החשוד מבודד מהספרים הבאים'); + expect(extractedDuringWrite['p1'], [ + 'p0', + 'p1', + 'p2', + ], reason: 'החילוץ הבא כבר הוזנק בזמן כתיבת השני'); + expect(engine.addedPdfTitles, ['p0', 'p1', 'p2']); + expect(repository.extractedTitles, ['p0', 'p1', 'p2']); + expect(provider.indexedFilePaths, books.map((b) => b.path).toSet()); + }); + for (final recoveringCommitted in [false, true]) { test( 'חילוצי PDF מוקדמים ללא כפילות (${recoveringCommitted ? 'אחרי קריסה וסמן חתום' : 'ריצה בריאה'})', @@ -5064,6 +5196,18 @@ class FakeTantivyDataProvider implements TantivyDataProvider { } } +class _EmptyDiagnosticsChangeDetector implements IndexChangeDetector { + @override + Future?> detectChanged( + List candidates, { + required Library library, + required bool Function() isCancelled, + required Future Function() waitWhilePaused, + void Function(Book book)? onMetadataOnlyChanged, + void Function(int processed, int total)? onProgress, + }) async => const []; +} + class _FakeSearchEngine implements SearchEngine { @override dynamic noSuchMethod(Invocation invocation) { @@ -5257,7 +5401,10 @@ class _FakeExtractionRepository extends IndexingRepository { } @override - Future extractPdfPagesGuarded(PdfBook book) async { + Future extractPdfPagesGuarded( + PdfBook book, { + void Function(int processed, int total)? onProgress, + }) async { extractedTitles.add(book.title); _activeExtractions++; peakConcurrentExtractions = max( @@ -5301,15 +5448,33 @@ class _FakeExtractionRepository extends IndexingRepository { } } +class _CanaryExtractionRepository extends _FakeExtractionRepository { + _CanaryExtractionRepository(super.provider); + + @override + Future extractPdfPagesGuarded( + PdfBook book, { + void Function(int processed, int total)? onProgress, + }) { + if (IndexingCrashCanary.current?.begin(book.path) == false) { + throw const IndexingCrashedBefore(); + } + return super.extractPdfPagesGuarded(book, onProgress: onProgress); + } +} + class _GatedPdfExtractionRepository extends _FakeExtractionRepository { _GatedPdfExtractionRepository(super.provider, this.extractionGate); final Future extractionGate; @override - Future extractPdfPagesGuarded(PdfBook book) async { + Future extractPdfPagesGuarded( + PdfBook book, { + void Function(int processed, int total)? onProgress, + }) async { await extractionGate; - return super.extractPdfPagesGuarded(book); + return super.extractPdfPagesGuarded(book, onProgress: onProgress); } } @@ -5569,12 +5734,11 @@ StampChangeDetector _textDetector( }) => StampChangeDetector( repository, loadSourceHashes: (_) async => sourceHashes ?? BookSourceHashes.none, - metadataFingerprint: - ({ - required String title, - required String topics, - List? extraFacets, - }) => metadataOf?.call(title) ?? _metadata, + metadataFingerprint: ({ + required String title, + required String topics, + List? extraFacets, + }) => metadataOf?.call(title) ?? _metadata, textMatchesIndex: fingerprintOf == null || loadText == null ? null : (book, textHash) async { diff --git a/test/indexing/repository/pdf_text_timeout_test.dart b/test/indexing/repository/pdf_text_timeout_test.dart index c65ae6f1e1..15ab17782b 100644 --- a/test/indexing/repository/pdf_text_timeout_test.dart +++ b/test/indexing/repository/pdf_text_timeout_test.dart @@ -5,6 +5,20 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/indexing/repository/indexing_repository.dart'; void main() { + test('חיווי עמודים כולל התחלה וסיום בלי אירוע לכל עמוד', () async { + final progress = <(int, int)>[]; + final result = await IndexingRepository.extractPageTextsWithRetry( + pageCount: 100, + loadPageText: (index) async => 'עמוד $index', + beforeEachPage: () async => true, + onProgress: (processed, total) => progress.add((processed, total)), + ); + expect(result!.texts.length, 100); + expect(progress.first, (0, 100)); + expect(progress.last, (100, 100)); + expect(progress.length, lessThan(100)); + }); + test('timeout ממתין לאותה עבודת עמוד ומקבל את התוצאה המאוחרת', () { fakeAsync((clock) { final first = Completer(); diff --git a/test/indexing/services/indexing_failure_reporter_test.dart b/test/indexing/services/indexing_failure_reporter_test.dart index 1cf69f85fd..f0a41f1312 100644 --- a/test/indexing/services/indexing_failure_reporter_test.dart +++ b/test/indexing/services/indexing_failure_reporter_test.dart @@ -3,9 +3,46 @@ import 'dart:io'; import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/core/error_log_file.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; +import 'package:otzaria/indexing/models/indexing_run_diagnostics.dart'; +import 'package:otzaria/indexing/models/indexing_resource_policy.dart'; import 'package:otzaria/indexing/services/indexing_failure_reporter.dart'; void main() { + test( + 'cancelled report preserves overlapping stage times and resource reason', + () { + final collector = IndexingRunDiagnosticsCollector() + ..recoveryStarted = true + ..addTime( + IndexingStage.pdfExtraction, + const Duration(microseconds: 1234), + ) + ..addTime(IndexingStage.engine, const Duration(seconds: 2)) + ..increment(IndexingCounter.pdfPages, 7) + ..recordResources( + const IndexingResourcePolicy(cpuCount: 4, mobile: false), + IndexingResourceMode.automatic, + ); + final report = IndexingFailureReporter.formatReport( + IndexingRunResult.cancelled( + processedBooks: 1, + totalBooks: 2, + indexedBooks: 1, + diagnostics: collector.snapshot(), + ), + memory: const {}, + elapsed: const Duration(seconds: 2), + ); + expect(report, contains('Completed: false')); + expect(report, contains('Recovery at start: true')); + expect(report, contains('overlapping stages; not additive')); + expect(report, contains('pdfExtraction: 1234us')); + expect(report, contains('engine: 2000000us')); + expect(report, contains('pdfPages: 7')); + expect(report, contains('mode=automatic reason=lowCpu cpu=4')); + expect(report, contains('totalRamMb=null availableRamMb=null')); + }, + ); const failures = [ IndexingFailure( bookTitle: 'מוגן', diff --git a/test/indexing/utils/indexing_crash_canary_test.dart b/test/indexing/utils/indexing_crash_canary_test.dart index d0a8d5e8d5..2820cda8b3 100644 --- a/test/indexing/utils/indexing_crash_canary_test.dart +++ b/test/indexing/utils/indexing_crash_canary_test.dart @@ -14,6 +14,42 @@ void main() { }); tearDown(() => IndexingCrashCanary.writeLog = ErrorLogFile.appendText); + test('עבודה חדשה אינה מחזירה ריצה בריאה למצב התאוששות', () async { + final temp = await Directory.systemTemp.createTemp('canary_recovery_'); + addTearDown(() => temp.delete(recursive: true)); + final index = p.join(temp.path, 'index'); + File('$index.in_flight.json').writeAsStringSync(jsonEncode({'old': 1})); + IndexingCrashCanary.start(index); + final canary = IndexingCrashCanary.current!; + addTearDown(canary.finish); + expect(canary.recovering, isTrue); + canary.begin('new'); + canary.begin('old'); + canary.end('old'); + expect(canary.recovering, isFalse); + await canary.flush(); + expect(jsonDecode(File('$index.in_flight.json').readAsStringSync()), { + 'new': 1, + }); + }); + + test('דילוג על חשוד נשאר בהתאוששות עד שנחתם', () async { + final temp = await Directory.systemTemp.createTemp('canary_skipped_'); + addTearDown(() => temp.delete(recursive: true)); + final index = p.join(temp.path, 'index'); + File('$index.in_flight.json').writeAsStringSync(jsonEncode({'old': 2})); + IndexingCrashCanary.start(index); + final canary = IndexingCrashCanary.current!; + addTearDown(canary.finish); + expect(canary.begin('old'), isFalse); + canary.end('old'); + expect(canary.recovering, isTrue); + canary.committed({'other'}); + expect(canary.recovering, isTrue); + canary.committed({'old'}); + expect(canary.recovering, isFalse); + }); + test( 'commit מנקה רק דילוג שנחתם, ומשמר ספר שעדיין מחולץ וספר שלא נבדק', () async { diff --git a/test/indexing/utils/pdf_extraction_prefetcher_test.dart b/test/indexing/utils/pdf_extraction_prefetcher_test.dart index 455f9cad59..f41e328858 100644 --- a/test/indexing/utils/pdf_extraction_prefetcher_test.dart +++ b/test/indexing/utils/pdf_extraction_prefetcher_test.dart @@ -48,6 +48,28 @@ bool _always(PdfBook book) => true; void main() { group('PdfExtractionPrefetcher.fill', () { + test('התאוששות מעכבת סריקה וחידוש אינו מדלג על ספר', () async { + final extractor = _ControlledExtractor(); + var recovering = true; + final prefetcher = PdfExtractionPrefetcher( + extract: extractor.call, + canPrefetch: () => !recovering, + fileSizeOf: (_) async => 0, + ); + addTearDown(prefetcher.dispose); + final books = [_pdf('p0'), _pdf('p1')]; + await prefetcher.fill(books, 0, shouldPrefetch: _always); + expect(extractor.started, isEmpty); + recovering = false; + await prefetcher.fill(books, 0, shouldPrefetch: _always); + expect(extractor.started, ['p0']); + await extractor.finish('p0'); + prefetcher.takeReady(); + await prefetcher.fill(books, 0, shouldPrefetch: _always); + expect(extractor.started, ['p0', 'p1']); + await extractor.finish('p1'); + }); + test('ברירת המחדל משאירה רק חילוץ יחיד בטיסה', () async { final extractor = _ControlledExtractor(); final prefetcher = PdfExtractionPrefetcher( diff --git a/test/migration/sync/external_book_conversion_benchmark_test.dart b/test/migration/sync/external_book_conversion_benchmark_test.dart new file mode 100644 index 0000000000..f3b4c745ac --- /dev/null +++ b/test/migration/sync/external_book_conversion_benchmark_test.dart @@ -0,0 +1,137 @@ +import 'dart:convert'; +import 'dart:io'; +import 'dart:isolate'; + +import 'package:crypto/crypto.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:otzaria/migration/database/query_loader.dart'; +import 'package:otzaria/migration/services/external_book_import.dart'; +import 'package:otzaria/utils/file/document_converter.dart'; +import 'package:otzaria/utils/file/document_format.dart'; +import 'package:otzaria/utils/file/docx_cache.dart'; +import 'package:path/path.dart' as path; + +import '../../utils/file/docx_golden_fixtures.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + test( + 'cold import plus indexing conversion benchmark', + () async { + final root = await Directory.systemTemp.createTemp( + 'import-cache-benchmark-', + ); + try { + await QueryLoader.initialize(); + final queries = QueryLoader.cacheSnapshot; + for (final lines in [20, 3000]) { + final files = []; + for (var i = 0; i < 6; i++) { + final file = File(path.join(root.path, 'book-$lines-$i.docx')); + await file.writeAsBytes( + buildDocx( + document: documentXml( + styledPara('Heading1', 'פרק א') + + List.generate( + lines, + (j) => para('תוכן עברי לבדיקה $i $j'), + ).join(), + ), + ), + ); + files.add(file.path); + } + final sourceBytes = await Future.wait( + files.map((file) => File(file).length()), + ); + List? oracle; + for (var run = 0; run < 6; run++) { + for (final cached in run.isEven ? [false, true] : [true, false]) { + final cachePath = path.join( + root.path, + 'cache-$lines-$run-$cached.db', + ); + final clock = Stopwatch()..start(); + final tocHashes = await Isolate.run(() async { + QueryLoader.seedCache(queries); + Future> prepare() async => [ + for (final file in files) + sha256 + .convert( + utf8.encode( + jsonEncode([ + for (final entry + in (await PreparedExternalBook.prepare( + file, + await File(file).stat(), + DocumentFormat.docx, + )).tocEntries!) + [ + entry.text, + entry.level, + entry.lineIndex, + entry.parentId, + ], + ]), + ), + ) + .toString(), + ]; + return cached + ? withImportConversionCache(cachePath, prepare) + : prepare(); + }); + final importMs = clock.elapsedMilliseconds; + final textHashes = await Isolate.run(() async { + QueryLoader.seedCache(queries); + return withImportConversionCache( + cachePath, + () async => [ + for (final file in files) + sha256 + .convert( + utf8.encode( + await convertDocumentForIndex( + File(file), + path.basenameWithoutExtension(file), + DocumentFormat.docx, + ), + ), + ) + .toString(), + ], + ); + }); + final hashes = [...tocHashes, ...textHashes]; + oracle ??= hashes; + expect( + hashes, + oracle, + reason: 'All TOC and indexed text must match', + ); + // This measures conversion/preparation, not native index construction. + debugPrint( + 'IMPORT_CONVERSION_BENCH ${jsonEncode({ + 'linesPerBook': lines, + 'books': files.length, + 'sourceBytes': sourceBytes, + 'scope': 'conversion-and-durable-cache-only', + 'run': run, + 'warmup': run == 0, + 'cachedImport': cached, + 'importMs': importMs, + 'totalMs': clock.elapsedMilliseconds, + })}', + ); + } + } + } + } finally { + await root.delete(recursive: true); + } + }, + skip: !const bool.fromEnvironment('OTZARIA_IMPORT_CACHE_BENCH'), + timeout: const Timeout(Duration(minutes: 15)), + ); +} diff --git a/test/migration/sync/external_book_conversion_cache_test.dart b/test/migration/sync/external_book_conversion_cache_test.dart new file mode 100644 index 0000000000..4ddf3fa850 --- /dev/null +++ b/test/migration/sync/external_book_conversion_cache_test.dart @@ -0,0 +1,413 @@ +import 'dart:convert'; +import 'dart:io'; +import 'dart:isolate'; +import 'dart:math'; + +import 'package:archive/archive.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:otzaria/data/data_providers/database_library_provider.dart'; +import 'package:otzaria/migration/database/daos/database.dart'; +import 'package:otzaria/migration/database/query_loader.dart'; +import 'package:otzaria/migration/database/repository/seforim_repository.dart'; +import 'package:otzaria/migration/services/external_book_import.dart'; +import 'package:otzaria/migration/sync/background_db_sync_worker.dart'; +import 'package:otzaria/settings/engine/app_settings_store.dart'; +import 'package:otzaria/settings/engine/settings_repository.dart'; +import 'package:otzaria/settings/services/custom_folders/custom_folder.dart'; +import 'package:otzaria/utils/file/document_converter.dart'; +import 'package:otzaria/utils/file/document_format.dart'; +import 'package:otzaria/utils/file/docx_cache.dart'; +import 'package:otzaria/utils/file/toc_parser.dart'; +import 'package:path/path.dart' as path; + +import '../../utils/file/docx_golden_fixtures.dart'; +import '../../test_helpers/memory_cache_provider.dart'; +import '../../../tool/src/document_fixtures/word_binary_builder.dart'; + +List _archive(Map entries) { + final archive = Archive(); + for (final entry in entries.entries) { + final bytes = utf8.encode(entry.value); + archive.addFile(ArchiveFile(entry.key, bytes.length, bytes)); + } + return ZipEncoder().encode(archive); +} + +List _largeDocx() { + final random = Random(6187); + final body = List.generate(800, (index) { + final text = String.fromCharCodes( + List.generate(40, (_) => 65 + random.nextInt(26)), + ); + return para('$index $text'); + }).join(); + return buildDocx(document: documentXml(body)); +} + +List _additionalFixture(DocumentFormat format) => switch (format) { + DocumentFormat.doc || + DocumentFormat.dot || + DocumentFormat.wbk => buildWordBinary([ + const WordPiece('שלום עולם\rתוכן הספר\r'), + ], template: format == DocumentFormat.dot), + DocumentFormat.rtf => utf8.encode( + r'{\rtf1\ansi\par Sample paragraph\par More text}', + ), + DocumentFormat.xml => utf8.encode( + '' + 'שלום עולם', + ), + DocumentFormat.odt => _archive({ + 'mimetype': 'application/vnd.oasis.opendocument.text', + 'content.xml': + '' + 'פרק א' + 'תוכן עברי', + }), + DocumentFormat.epub => _archive({ + 'mimetype': 'application/epub+zip', + 'META-INF/container.xml': + '' + '' + '', + 'content.opf': + '' + 'ספר' + '' + '', + 'chapter.xhtml': + '

פרק א

' + '

תוכן עברי

', + }), + _ => throw ArgumentError.value(format), +}; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + late Directory root; + late String cachePath; + late Map> queries; + + setUp(() async { + root = await Directory.systemTemp.createTemp('import-conversion-cache-'); + cachePath = path.join(root.path, 'custom-cache.db'); + await QueryLoader.initialize(); + queries = QueryLoader.cacheSnapshot; + }); + + tearDown(() async => root.delete(recursive: true)); + + List toc(PreparedExternalBook book) => [ + for (final entry in book.tocEntries ?? []) + ( + entry.text, + entry.level, + entry.lineIndex, + entry.parentId, + entry.hasChildren, + entry.isLastChild, + ), + ]; + + Future import(File file, DocumentFormat format) async { + final filePath = file.path; + final stat = await file.stat(); + final dbPath = cachePath; + final querySnapshot = queries; + return Isolate.run(() async { + QueryLoader.seedCache(querySnapshot); + return withImportConversionCache( + dbPath, + () => prepareExternalBookInIsolate(filePath, stat, format), + minimumSourceBytes: 0, + ); + }); + } + + Future cachedText(String key) async { + final database = MyDatabase.withPath(cachePath); + try { + final repository = SeforimRepository(database); + await repository.ensureInitialized(); + return (await repository.getDocxTextCacheEntry(key))?.text; + } finally { + database.close(); + } + } + + for (final format in [ + DocumentFormat.epub, + DocumentFormat.odt, + DocumentFormat.rtf, + DocumentFormat.xml, + DocumentFormat.doc, + DocumentFormat.dot, + DocumentFormat.wbk, + ]) { + test('שקילות ייבוא ואינדוקס בפורמט $format', () async { + final file = File(path.join(root.path, 'ספר.${format.extension}')); + await file.writeAsBytes(_additionalFixture(format)); + final canonical = await convertDocumentFile( + file.path, + embedImages: false, + ); + final baseline = await PreparedExternalBook.prepare( + file.path, + await file.stat(), + format, + ); + final prepared = await import(file, format); + expect(toc(prepared), toc(baseline)); + final indexed = await withImportConversionCache( + cachePath, + () => convertDocumentForIndex(file, 'ספר', format), + ); + expect(indexed, canonical); + expect(await File(cachePath).exists(), isTrue); + }); + } + + test( + 'אינדוקס אחרי יציאת worker משתמש בתוצאה השמורה ללא המרה חוזרת', + () async { + final file = File(path.join(root.path, 'ספר.docx')); + final bytes = buildDocx( + document: documentXml(styledPara('Heading1', 'פרק א') + para('תוכן')), + ); + await file.writeAsBytes(bytes); + final canonical = await convertDocumentFile( + file.path, + embedImages: false, + ); + await import(file, DocumentFormat.docx); + final stat = await file.stat(); + // אותו מפתח תוקף, אבל הממיר אינו מסוגל לקרוא את המקור — הצלחה מוכיחה cache-hit. + await file.writeAsBytes(List.filled(bytes.length, 0)); + await file.setLastModified(stat.modified); + final indexed = await withImportConversionCache( + cachePath, + () => convertDocumentForIndex(file, 'ספר', DocumentFormat.docx), + ); + expect(indexed, canonical); + }, + ); + + test('worker הסנכרון האמיתי כותב למטמון שבנתיב ההגדרות המבודד', () async { + await Settings.init(cacheProvider: MemoryCacheProvider()); + await Settings.setValue(SettingsRepository.keyDatabasesPath, root.path); + cachePath = path.join(root.path, 'cache.db'); + final officialPath = path.join(root.path, 'official.db'); + final userPath = path.join(root.path, 'user_books.db'); + for (final dbPath in [officialPath, userPath]) { + final db = MyDatabase.withPath(dbPath); + try { + await SeforimRepository(db).ensureInitialized(); + } finally { + await db.closeInBackground(); + } + } + final folder = await Directory(path.join(root.path, 'books')).create(); + final file = File(path.join(folder.path, 'ספר.docx')); + await file.writeAsBytes(_largeDocx()); + expect((await file.stat()).size, greaterThanOrEqualTo(8192)); + final result = await runCustomFoldersDbSyncInIsolate( + dbPath: officialPath, + userBooksDbPath: userPath, + customFolders: [ + CustomFolder( + path: folder.path, + addToDatabase: false, + addedAt: DateTime(2026), + ), + ], + ); + expect(result.errors, isEmpty); + expect(result.addedBooks, 1); + expect( + await cachedText('${file.path}#ooxml-without-images'), + await convertDocumentFile(file.path, embedImages: false), + ); + }); + + test('סורק ההוספה משתמש במטמון ב-worker ושומר תוצאה לפני החזרה', () async { + final folder = await Directory(path.join(root.path, 'scan')).create(); + final file = File(path.join(folder.path, 'ספר.docx')); + await file.writeAsBytes(_largeDocx()); + expect((await file.stat()).size, greaterThanOrEqualTo(8192)); + final discovered = await scanExternalFolderForTest( + folder.path, + 'תיקייה', + path.join(root.path, 'missing-user.db'), + conversionCachePath: cachePath, + ); + expect(discovered.single['path'], file.path); + expect( + await cachedText('${file.path}#ooxml-without-images'), + await convertDocumentFile(file.path, embedImages: false), + ); + }); + + for (final format in [ + DocumentFormat.docx, + DocumentFormat.docm, + DocumentFormat.dotx, + DocumentFormat.dotm, + DocumentFormat.html, + DocumentFormat.htm, + DocumentFormat.xhtml, + ]) { + test('ייבוא $format שומר פלט שקול במטמון לפני יציאת worker', () async { + final file = File(path.join(root.path, 'ספר.${format.extension}')); + if (format.isOoxmlWord) { + await file.writeAsBytes( + buildDocx( + document: documentXml( + styledPara('Heading1', 'פרק א') + para('תוכן עברי'), + ), + ), + ); + } else { + await file.writeAsString( + '

פרק א

' + '

תוכן עברי

', + ); + } + final canonical = await convertDocumentFile( + file.path, + embedImages: false, + ); + final baseline = await PreparedExternalBook.prepare( + file.path, + await file.stat(), + format, + ); + final prepared = await import(file, format); + expect(toc(prepared), toc(baseline)); + final variant = format.isOoxmlWord + ? 'ooxml-without-images' + : 'html-without-images'; + expect(await cachedText('${file.path}#$variant'), canonical); + // המטמון משמש את האינדוקס אחרי שה-worker שכתב אותו הסתיים. + final indexed = await withImportConversionCache( + cachePath, + () => convertDocumentForIndex(file, 'ספר', format), + ); + expect(indexed, canonical); + expect( + externalBookTocEntries(TocParser.parseEntriesFromContent(indexed)) + .map((e) => e.lineIndex), + prepared.tocEntries!.map((e) => e.lineIndex), + ); + }); + } + + test('שינוי מסמך מחליף את המטמון ואת תוכן העניינים', () async { + final file = File(path.join(root.path, 'ספר.html')); + await file.writeAsString('

ראשון

תוכן

'); + final first = await import(file, DocumentFormat.html); + await file.writeAsString('

פרק חדש וארוך

תוכן שונה

'); + final second = await import(file, DocumentFormat.html); + expect(toc(second), isNot(toc(first))); + expect( + await cachedText('${file.path}#html-without-images'), + await convertDocumentFile(file.path, embedImages: false), + ); + }); + + test('מטמון שאינו כתיב אינו מונע ייבוא ואינו משנה כותרות', () async { + final file = await File(path.join(root.path, 'ספר.html')) + .writeAsString('

פרק

תוכן

'); + final baseline = await PreparedExternalBook.prepare( + file.path, + await file.stat(), + DocumentFormat.html, + ); + cachePath = root.path; + expect(toc(await import(file, DocumentFormat.html)), toc(baseline)); + }); + + test('טקסט רגיל ו-Markdown אינם יוצרים מטמון מסמכים', () async { + for (final format in [DocumentFormat.txt, DocumentFormat.md]) { + final file = await File(path.join(root.path, 'ספר.${format.extension}')) + .writeAsString('# כותרת\nתוכן'); + final baseline = await PreparedExternalBook.prepare( + file.path, + await file.stat(), + format, + ); + expect(toc(await import(file, format)), toc(baseline)); + } + expect(await File(cachePath).exists(), isFalse); + }); + + test('ייבואים מקבילים לאותו קובץ שומרים כל מטמון בנתיבו', () async { + final file = await File(path.join(root.path, 'shared.html')) + .writeAsString('

פרק

תוכן

'); + final stat = await file.stat(); + final secondCache = path.join(root.path, 'second-cache.db'); + final prepared = await Future.wait([ + for (final target in [cachePath, secondCache]) + withImportConversionCache( + target, + () => PreparedExternalBook.prepare( + file.path, + stat, + DocumentFormat.html, + ), + minimumSourceBytes: 0, + ), + ]); + expect(toc(prepared.first), toc(prepared.last)); + final expected = await cachedText('${file.path}#html-without-images'); + expect(expected, isNotNull); + cachePath = secondCache; + expect(await cachedText('${file.path}#html-without-images'), expected); + }); + + test('סף ברירת המחדל הוא 8KiB ואינו פותח מטמון ללא המרה', () async { + expect(canCacheImportedDocument(8192), isFalse); + await withImportConversionCache(cachePath, () async { + expect(canCacheImportedDocument(8191), isFalse); + expect(canCacheImportedDocument(8192), isTrue); + expect(canCacheImportedDocument(8193), isTrue); + }); + expect(await File(cachePath).exists(), isFalse); + }); + + for (final large in [false, true]) { + test( + 'הכנת DOCX ${large ? 'גדול' : 'קטן'} מכבדת את סף ברירת המחדל', + () async { + final file = File(path.join(root.path, 'ספר.docx')); + await file.writeAsBytes( + large ? _largeDocx() : buildDocx(document: documentXml(para('תוכן'))), + ); + final stat = await file.stat(); + expect(stat.size >= 8192, large); + final baseline = await PreparedExternalBook.prepare( + file.path, + stat, + DocumentFormat.docx, + ); + final prepared = await withImportConversionCache( + cachePath, + () => PreparedExternalBook.prepare( + file.path, + stat, + DocumentFormat.docx, + ), + ); + expect(toc(prepared), toc(baseline)); + expect(await File(cachePath).exists(), large); + if (large) { + expect( + await cachedText('${file.path}#ooxml-without-images'), + await convertDocumentFile(file.path, embedImages: false), + ); + } + }, + ); + } +} diff --git a/test/support/indexing_progress_capture_test.dart b/test/support/indexing_progress_capture_test.dart new file mode 100644 index 0000000000..5b129aa4bd --- /dev/null +++ b/test/support/indexing_progress_capture_test.dart @@ -0,0 +1,116 @@ +import 'dart:io'; +import 'dart:ui' as ui; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:otzaria/indexing/bloc/indexing_state.dart'; +import 'package:otzaria/indexing/indexing_work_status.dart'; +import 'package:otzaria/theme/app_seed_colors.dart'; +import 'package:otzaria/theme/app_theme_data.dart'; +import 'package:otzaria/work_status/work_status_cubit.dart'; +import 'package:otzaria/work_status/work_status_overlay.dart'; + +import 'golden_fonts.dart'; + +void main() { + final output = Platform.environment['OTZARIA_INDEXING_UI_CAPTURE_OUT']; + for (final compact in [false, true]) { + for (final brightness in Brightness.values) { + testWidgets( + 'indexing progress capture ${compact ? 'compact' : 'desktop'} ${brightness.name}', + (tester) async { + debugDefaultTargetPlatformOverride = goldenPlatform; + addTearDown(() => debugDefaultTargetPlatformOverride = null); + tester.view.devicePixelRatio = 1; + tester.view.physicalSize = Size(compact ? 360 : 900, 360); + addTearDown(tester.view.resetDevicePixelRatio); + addTearDown(tester.view.resetPhysicalSize); + await loadGoldenFonts(); + + final cubit = WorkStatusCubit(); + addTearDown(cubit.close); + final boundaryKey = GlobalKey(); + final scheme = AppThemeData.createColorScheme( + brightness == Brightness.light + ? AppSeedColors.defaultLight + : AppSeedColors.defaultDark, + brightness, + ); + final theme = brightness == Brightness.light + ? AppThemeData.light(scheme, compactMenuMode: compact) + : AppThemeData.dark(scheme, compactMenuMode: compact); + + for (final after in [false, true]) { + cubit.upsert( + indexingWorkStatusItem( + IndexingInProgress( + booksProcessed: 7, + totalBooks: 12, + pdfPagesProcessed: after ? 23 : null, + pdfTotalPages: after ? 120 : null, + ), + onTogglePause: () {}, + onToggleEconomy: () {}, + ), + ); + await tester.pumpWidget( + BlocProvider.value( + value: cubit, + child: MaterialApp( + debugShowCheckedModeBanner: false, + theme: theme, + locale: const Locale('he', 'IL'), + supportedLocales: const [Locale('he', 'IL')], + localizationsDelegates: GlobalMaterialLocalizations.delegates, + home: RepaintBoundary( + key: boundaryKey, + child: const Scaffold( + body: Stack(children: [WorkStatusOverlay()]), + ), + ), + ), + ), + ); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + expect(find.text('אינדוקס ספרים'), findsOneWidget); + expect(find.text('השהה'), findsOneWidget); + expect( + find.textContaining('חילוץ PDF ברקע'), + after ? findsOneWidget : findsNothing, + ); + expect( + Directionality.of(tester.element(find.byType(WorkStatusOverlay))), + TextDirection.rtl, + ); + final boundary = + boundaryKey.currentContext!.findRenderObject()! + as RenderRepaintBoundary; + final name = + '${after ? 'after' : 'before'}-${compact ? 'compact' : 'desktop'}-${brightness.name}.png'; + await tester.runAsync(() async { + final image = await boundary.toImage(); + try { + final data = await image.toByteData( + format: ui.ImageByteFormat.png, + ); + final file = File('$output/$name'); + await file.parent.create(recursive: true); + await file.writeAsBytes(data!.buffer.asUint8List()); + } finally { + image.dispose(); + } + }); + } + await tester.pumpWidget(const SizedBox.shrink()); + debugDefaultTargetPlatformOverride = null; + }, + skip: output == null, + ); + } + } +} diff --git a/test/tool/perf_probe/indexing_native_probe_test.dart b/test/tool/perf_probe/indexing_native_probe_test.dart new file mode 100644 index 0000000000..46e70d2ee5 --- /dev/null +++ b/test/tool/perf_probe/indexing_native_probe_test.dart @@ -0,0 +1,219 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:archive/archive.dart'; +import 'package:crypto/crypto.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:otzaria/core/app_paths.dart'; +import 'package:otzaria/data/data_providers/cache_database_holder.dart'; +import 'package:otzaria/data/data_providers/tantivy_data_provider.dart'; +import 'package:otzaria/indexing/models/index_update_mode.dart'; +import 'package:otzaria/indexing/repository/indexing_repository.dart'; +import 'package:otzaria/library/models/library.dart'; +import 'package:otzaria/migration/services/external_book_import.dart'; +import 'package:otzaria/models/book_source.dart'; +import 'package:otzaria/models/books.dart'; +import 'package:otzaria/settings/engine/app_settings_store.dart'; +import 'package:otzaria/settings/engine/settings_repository.dart'; +import 'package:otzaria/utils/file/document_format.dart'; +import 'package:otzaria/utils/file/document_converter.dart'; +import 'package:otzaria_search_engine/otzaria_search_engine.dart'; +import 'package:pdfrx/pdfrx.dart'; + +import '../../../integration_test/support/installed_plugin_pdf_fixture.dart'; +import '../../support/search_engine_test_init.dart'; +import '../../test_helpers/memory_cache_provider.dart'; + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final output = Platform.environment['OTZARIA_INDEXING_PROBE_OUT']; + test( + 'isolated native indexing measurement', + () async { + expect(await tryInitSearchEngine(), true, reason: searchEngineSkipReason); + final loadedEngine = File(searchEngineLoadedLibraryPath!); + final loadedEngineDigest = sha256 + .convert(await loadedEngine.readAsBytes()) + .toString(); + final root = await Directory.systemTemp.createTemp('indexing-probe-'); + final oldModule = Pdfrx.pdfiumModulePath; + final module = Platform.isWindows + ? 'pdfium.dll' + : Platform.isMacOS + ? 'libpdfium_dart.dylib' + : 'libpdfium.so'; + Pdfrx.pdfiumModulePath = File( + 'build/native_assets/${Platform.operatingSystem}/$module', + ).absolute.path; + await pdfrxInitialize(tmpPath: root.path); + AppPaths.debugOverrideDataRootPath(root.path); + addTearDown(() async { + await CacheDatabaseHolder.instance.close(); + AppPaths.debugOverrideDataRootPath(null); + Pdfrx.pdfiumModulePath = oldModule; + await root.delete(recursive: true); + }); + final rows = >[]; + final manifest = {}; + for (final economy in [false, true]) { + for (final kind in ['txt', 'docx', 'pdf', 'pdf-recovery']) { + final directory = await Directory('${root.path}/$kind-$economy') + .create(); + await Settings.init(cacheProvider: MemoryCacheProvider()); + await Settings.setValue( + SettingsRepository.keyDatabasesPath, + directory.path, + ); + await Settings.setValue( + SettingsRepository.keyLibraryPath, + directory.path, + ); + final index = await Directory('${directory.path}/index').create(); + final engine = await SearchEngine.newInstance(path: index.path); + final provider = TantivyDataProvider.forTesting(Future.value(engine)) + ..activeIndexPath = index.path + ..isInitialized.value = true; + TantivyDataProvider.instance = provider; + final repository = IndexingRepository( + provider, + indexPdfBooks: () => true, + indexUpdateMode: () => IndexUpdateMode.all, + ); + await repository.setEconomyIndexing(economy); + final pdf = kind.startsWith('pdf'); + final extension = pdf ? 'pdf' : kind; + final books = []; + final texts = List.generate( + 1000, + (i) => + 'benchmarktoken שורה מספר $i עם תוכן ארוך מספיק לאינדוקס ומילים נוספות לבדיקת שלמות התוצאות', + ); + final archive = Archive(); + final xml = utf8.encode( + '${texts.map((line) => '$line').join()}', + ); + archive.addFile( + ArchiveFile('word/document.xml', xml.length, xml)..lastModTime = 0, + ); + final bytes = pdf + ? createInstalledPdfFixture() + : kind == 'docx' + ? ZipEncoder().encode(archive) + : utf8.encode(texts.join('\n')); + manifest[kind] = sha256.convert(bytes).toString(); + for (var i = 0; i < 8; i++) { + final file = await File('${directory.path}/book$i.$extension') + .writeAsBytes(bytes); + books.add( + pdf + ? PdfBook( + title: 'book$i', + path: file.path, + source: BookSource.user, + ) + : kind == 'txt' + ? _FileTextBook(title: 'book$i', path: file.path) + : TextBook( + title: 'book$i', + filePath: file.path, + fileType: kind, + source: BookSource.user, + ), + ); + } + if (kind == 'pdf-recovery') { + await File('${index.path}.in_flight.json').writeAsString( + jsonEncode({ + books.first.filePath ?? (books.first as PdfBook).path: 1, + }), + ); + } + final library = Library(categories: [])..books.addAll(books); + final watch = Stopwatch()..start(); + if (!pdf) { + for (final book in books) { + final file = File(book.filePath!); + await PreparedExternalBook.prepare( + file.path, + await file.stat(), + kind == 'docx' ? DocumentFormat.docx : DocumentFormat.txt, + ); + } + } + final result = await repository.runIndexing( + library, + books: books, + onProgress: (_, _) {}, + ); + watch.stop(); + expect(result.isClean, true, reason: '${result.failures}'); + expect(result.indexedBooks, 8); + final hits = await engine.searchExact( + query: pdf ? installedPdfQuery : 'benchmarktoken', + facets: const [], + limit: 10000, + offset: 0, + order: ResultsOrder.catalogue, + matchNikud: false, + matchTaamim: false, + ); + final expected = pdf ? 32 : 8000; + expect(hits, hasLength(expected)); + final fingerprints = + (await engine.getBookFingerprints()).values + .map((v) => v.toString()) + .toList() + ..sort(); + expect(fingerprints, hasLength(8)); + rows.add({ + 'case': kind, + 'economy': economy, + 'elapsedUs': watch.elapsedMicroseconds, + 'documentsMatched': hits.length, + 'books': result.indexedBooks, + 'fingerprintSha256': sha256 + .convert(utf8.encode(jsonEncode(fingerprints))) + .toString(), + 'rssBytesAfter': ProcessInfo.currentRss, + 'peakRssBytesProcess': ProcessInfo.maxRss, + }); + await engine.closeIndexWriter(); + engine.dispose(); + await CacheDatabaseHolder.instance.close(); + } + } + await File(output!).writeAsString( + jsonEncode({ + 'schemaVersion': 1, + 'buildMode': 'flutter-test-debug/native-build-hook', + 'os': Platform.operatingSystem, + 'dartVersion': Platform.version, + 'processors': Platform.numberOfProcessors, + 'cacheState': 'fresh application index/cache; OS cache uncontrolled', + 'scope': 'metadata preparation and repository indexing, not folder scanning or UI responsiveness', + 'manifest': manifest, + 'loadedEnginePath': loadedEngine.absolute.path, + 'loadedEngineSha256': loadedEngineDigest, + 'pdfiumSha256': sha256 + .convert(await File(Pdfrx.pdfiumModulePath!).readAsBytes()) + .toString(), + 'rows': rows, + }), + ); + }, + skip: output == null + ? 'Set OTZARIA_INDEXING_PROBE_OUT to measure indexing' + : false, + timeout: const Timeout(Duration(minutes: 15)), + ); +} + +/// הקטלוג אינו חלק מהמדידה; הקובץ נקרא דרך מפענח הטקסט של האפליקציה. +class _FileTextBook extends TextBook { + _FileTextBook({required super.title, required String path}) + : super(filePath: path, fileType: 'txt', source: BookSource.user); + + @override + Future get text async => + (await readFileBackedBookText(File(filePath!), fileType, title))!; +} diff --git a/tool/perf_probe/run_indexing_pair.py b/tool/perf_probe/run_indexing_pair.py new file mode 100644 index 0000000000..27b51849e7 --- /dev/null +++ b/tool/perf_probe/run_indexing_pair.py @@ -0,0 +1,166 @@ +"""Compare native indexing through the same Flutter-test harness on one host.""" + +import argparse +import hashlib +import json +import os +from pathlib import Path +import re +import shutil +import statistics +import subprocess +import tempfile + + +HARNESS = "test/tool/perf_probe/indexing_native_probe_test.dart" +SUPPORT = [HARNESS, "integration_test/support/installed_plugin_pdf_fixture.dart", + "test/support/search_engine_test_init.dart", + "test/test_helpers/memory_cache_provider.dart"] +CASES = {(kind, economy) for kind in ("txt", "docx", "pdf", "pdf-recovery") + for economy in (False, True)} + + +def command(args, cwd, log=None, env=None): + process = subprocess.run(args, cwd=cwd, env=env, text=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + encoding="utf-8", errors="replace") + if log: + log.write_text(process.stdout, encoding="utf-8") + if process.returncode: + raise RuntimeError(f"Command failed ({process.returncode}): {args}; log={log}") + return process.stdout.strip() + + +def validate(report): + if report.get("schemaVersion") != 1: + raise ValueError("Unsupported or absent indexing report schema") + keys = [(row["case"], row["economy"]) for row in report["rows"]] + if len(keys) != len(CASES) or set(keys) != CASES: + raise ValueError("Missing, duplicated or unexpected indexing cases") + for row in report["rows"]: + expected = 32 if row["case"].startswith("pdf") else 8000 + if row["documentsMatched"] != expected or row["books"] != 8: + raise ValueError("Incomplete indexed corpus") + if row["elapsedUs"] <= 0 or not re.fullmatch(r"[0-9a-f]{64}", row["fingerprintSha256"]): + raise ValueError("Invalid duration or content fingerprint") + for key in ("loadedEngineSha256", "pdfiumSha256"): + if not re.fullmatch(r"[0-9a-f]{64}", report.get(key, "")): + raise ValueError(f"Loaded native binary identity missing: {key}") + if not report.get("loadedEnginePath"): + raise ValueError("Loaded engine path missing") + + +def compare(samples): + reference = samples[0]["report"] + for sample in samples: + report = sample["report"] + validate(report) + for key in ("manifest", "buildMode", "os", "dartVersion", "processors", "cacheState", + "loadedEngineSha256", "pdfiumSha256"): + if report[key] != reference[key]: + raise ValueError(f"Non-comparable metadata: {key}") + measured = [sample for sample in samples if not sample["warmup"]] + results = [] + for kind, economy in sorted(CASES): + by_role = {} + fingerprints = set() + for role in ("baseline", "candidate"): + rows = [row for sample in measured if sample["role"] == role + for row in sample["report"]["rows"] + if row["case"] == kind and row["economy"] == economy] + if len(rows) < 5: + raise ValueError("At least five measured repetitions per source required") + fingerprints.update(row["fingerprintSha256"] for row in rows) + median = statistics.median(row["elapsedUs"] for row in rows) + by_role[role] = {"medianMs": median / 1000, + "documentsPerSecond": rows[0]["documentsMatched"] * 1_000_000 / median, + "rssBytesAfterMedian": statistics.median(row["rssBytesAfter"] for row in rows), + "peakRssBytesProcessMedian": statistics.median(row["peakRssBytesProcess"] for row in rows), + "samples": len(rows)} + if len(fingerprints) != 1: + raise ValueError(f"Indexed contents changed: {kind}, economy={economy}") + results.append({"case": kind, "economy": economy, **by_role, + "durationRatio": by_role["candidate"]["medianMs"] / by_role["baseline"]["medianMs"]}) + return results + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--baseline", required=True) + parser.add_argument("--candidate", required=True) + parser.add_argument("--output", type=Path, required=True) + parser.add_argument("--repetitions", type=int, default=5) + parser.add_argument("--warmups", type=int, default=1) + args = parser.parse_args() + for commit in (args.baseline, args.candidate): + if not re.fullmatch(r"[0-9a-f]{40}", commit): + parser.error("Sources must be full immutable commit SHAs") + if args.repetitions < 5 or args.warmups < 1: + parser.error("Require at least five measured repetitions and one warmup") + root = Path(command(["git", "rev-parse", "--show-toplevel"], Path.cwd())) + flutter = shutil.which("flutter.bat" if os.name == "nt" else "flutter") + if not flutter: + parser.error("Flutter SDK not found") + output = args.output.resolve() + output.mkdir(parents=True, exist_ok=True) + snapshots = {} + samples = [] + shared_engine = None + with tempfile.TemporaryDirectory(prefix="otzaria-indexing-pair-") as temporary: + scratch = Path(temporary) + try: + for role, commit in (("baseline", args.baseline), ("candidate", args.candidate)): + checkout = scratch / role + command(["git", "worktree", "add", "--detach", str(checkout), commit], root) + snapshots[role] = checkout + for relative in SUPPORT: + target = checkout / relative + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(root / relative, target) + command([flutter, "pub", "get", "--enforce-lockfile"], checkout, output / f"{role}-pub.log") + locks = [hashlib.sha256((path / "pubspec.lock").read_bytes()).hexdigest() + for path in snapshots.values()] + if locks[0] != locks[1]: + raise ValueError("Lockfiles differ; this experiment isolates app-code changes") + for iteration in range(args.warmups + args.repetitions): + order = ("baseline", "candidate") if iteration % 2 == 0 else ("candidate", "baseline") + for role in order: + name = f"{iteration:02}-{role}" + raw = output / f"{name}.json" + env = dict(os.environ, OTZARIA_INDEXING_PROBE_OUT=str(raw)) + if shared_engine: + env.update(OTZARIA_SEARCH_ENGINE_LIBRARY_PATH=shared_engine[0], + OTZARIA_EXPECTED_SEARCH_ENGINE_SHA256=shared_engine[1]) + command([flutter, "test", "--no-pub", HARNESS, "--concurrency=1"], + snapshots[role], output / f"{name}.log", env) + report = json.loads(raw.read_text(encoding="utf-8")) + validate(report) + if shared_engine is None: + loaded = Path(report["loadedEnginePath"]) + if not loaded.is_file(): + raise ValueError("Loaded engine disappeared before paired measurement") + shared = scratch / "shared-native" / loaded.name + shared.parent.mkdir() + shutil.copy2(loaded, shared) + shared_engine = (str(shared), report["loadedEngineSha256"]) + samples.append({"role": role, "iteration": iteration, + "warmup": iteration < args.warmups, "report": report}) + (output / "raw.json").write_text(json.dumps(samples, ensure_ascii=False, indent=2), encoding="utf-8") + result = {"baseline": args.baseline, "candidate": args.candidate, + "lockSha256": locks[0], + "harnessSha256": hashlib.sha256((root / HARNESS).read_bytes()).hexdigest(), + "limitations": ["Flutter test debug harness; not release app performance", + "OS caches uncontrolled; fresh app index/cache per case", + "No UI frame or concurrent-search measurement", + "Peak RSS is cumulative per process, not attributable to one case", + "Metadata preparation and indexing; excludes folder discovery and worker import cache"], + "comparisons": compare(samples)} + (output / "comparison.json").write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8") + print(json.dumps(result, ensure_ascii=False, indent=2)) + finally: + for checkout in snapshots.values(): + command(["git", "worktree", "remove", "--force", str(checkout)], root) + + +if __name__ == "__main__": + main() diff --git a/tool/perf_probe/test_indexing_pair.py b/tool/perf_probe/test_indexing_pair.py new file mode 100644 index 0000000000..77205dd2b7 --- /dev/null +++ b/tool/perf_probe/test_indexing_pair.py @@ -0,0 +1,59 @@ +import copy +import unittest + +from tool.perf_probe.run_indexing_pair import CASES, compare, validate + + +def fixture(): + return {"schemaVersion": 1, "manifest": {"txt": "abc"}, "buildMode": "test", + "os": "windows", "dartVersion": "test", "processors": 8, + "cacheState": "fresh", "loadedEnginePath": "engine", + "loadedEngineSha256": "c" * 64, "pdfiumSha256": "d" * 64, + "rows": [{"case": kind, "economy": economy, "elapsedUs": 1000, + "documentsMatched": 32 if kind.startswith("pdf") else 8000, + "books": 8, "fingerprintSha256": "a" * 64, + "rssBytesAfter": 10, "peakRssBytesProcess": 20} + for kind, economy in sorted(CASES)]} + + +class IndexingPairTests(unittest.TestCase): + def samples(self): + return [{"role": role, "warmup": iteration == 0, "report": fixture()} + for iteration in range(6) for role in ("baseline", "candidate")] + + def test_complete_comparison_excludes_warmup(self): + samples = self.samples() + samples[0]["report"]["rows"][0]["elapsedUs"] = 1000000 + result = compare(samples) + self.assertEqual(len(result), 8) + self.assertTrue(all(row["durationRatio"] == 1 for row in result)) + self.assertTrue(all(row["baseline"]["samples"] == 5 for row in result)) + + def test_partial_duplicate_or_zero_time_is_rejected(self): + for mutate in [lambda r: r["rows"].pop(), + lambda r: r["rows"].append(copy.deepcopy(r["rows"][0])), + lambda r: r["rows"][0].update(elapsedUs=0), + lambda r: r["rows"][0].update(documentsMatched=0)]: + report = fixture() + mutate(report) + with self.assertRaises(ValueError): + validate(report) + + def test_input_mode_or_fingerprint_changes_are_rejected(self): + for mutate in [lambda r: r.update(buildMode="release"), + lambda r: r.update(manifest={"txt": "changed"}), + lambda r: r.update(loadedEngineSha256="e" * 64), + lambda r: r.update(pdfiumSha256="e" * 64), + lambda r: r["rows"][0].update(fingerprintSha256="b" * 64)]: + samples = self.samples() + mutate(samples[-1]["report"]) + with self.assertRaises(ValueError): + compare(samples) + + def test_too_few_repetitions_are_rejected(self): + with self.assertRaises(ValueError): + compare(self.samples()[:-2]) + + +if __name__ == "__main__": + unittest.main() diff --git a/tool/perf_probe/verify_indexing_recovery_regression.py b/tool/perf_probe/verify_indexing_recovery_regression.py new file mode 100644 index 0000000000..e6912f6916 --- /dev/null +++ b/tool/perf_probe/verify_indexing_recovery_regression.py @@ -0,0 +1,46 @@ +"""Require the recovery regression to fail on the base and pass on the candidate.""" + +import argparse +import os +from pathlib import Path +import re +import shutil +import subprocess + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--baseline", required=True) + parser.add_argument("--output", type=Path, required=True) + args = parser.parse_args() + if not re.fullmatch(r"[a-f0-9]{40}", args.baseline): + parser.error("An immutable baseline SHA is required") + flutter = shutil.which("flutter.bat" if os.name == "nt" else "flutter") + if not flutter: + parser.error("Flutter SDK not found") + source = Path("lib/indexing/utils/indexing_crash_canary.dart") + test = Path("test/indexing/utils/indexing_crash_canary_test.dart") + name = re.search(r"test\('([^']+)'", test.read_text(encoding="utf-8")).group(1) + baseline = subprocess.check_output(["git", "show", f"{args.baseline}:{source.as_posix()}"]) + candidate = source.read_bytes() + args.output.mkdir(parents=True, exist_ok=True) + try: + for label, content in (("baseline", baseline), ("candidate", candidate)): + source.write_bytes(content) + result = subprocess.run( + [flutter, "test", "--no-pub", str(test), "--plain-name", name], + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + text=True, encoding="utf-8", errors="replace", check=False, + ) + (args.output / f"recovery-{label}.log").write_text(result.stdout, encoding="utf-8") + if label == "baseline": + if result.returncode != 1 or "Expected: false" not in result.stdout or "Actual: " not in result.stdout: + raise RuntimeError("Baseline did not fail at the intended recovery assertion") + elif result.returncode: + raise RuntimeError("Candidate failed the recovery regression") + finally: + source.write_bytes(candidate) + + +if __name__ == "__main__": + main() From 05370d73e7097de86b50cf90720ba11c3428ca3a Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Tue, 1 Dec 2026 23:31:14 +0200 Subject: [PATCH 02/11] =?UTF-8?q?=D7=91=D7=93=D7=99=D7=A7=D7=AA=20=D7=91?= =?UTF-8?q?=D7=99=D7=A6=D7=95=D7=A2=D7=99=D7=9D:=20=D7=94=D7=A9=D7=95?= =?UTF-8?q?=D7=95=D7=90=D7=AA=20=D7=97=D7=95=D7=AA=D7=9E=D7=95=D7=AA=20?= =?UTF-8?q?=D7=98=D7=A7=D7=A1=D7=98=20=D7=95=D7=AA=D7=95=D7=9B=D7=9F=20?= =?UTF-8?q?=D7=9C=D7=9B=D7=9C=20=D7=A1=D7=A4=D7=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexing_native_probe_test.dart | 58 ++++++++++++++++--- tool/perf_probe/run_indexing_pair.py | 27 +++++++-- tool/perf_probe/test_indexing_pair.py | 34 ++++++++++- 3 files changed, 103 insertions(+), 16 deletions(-) diff --git a/test/tool/perf_probe/indexing_native_probe_test.dart b/test/tool/perf_probe/indexing_native_probe_test.dart index 46e70d2ee5..28bb9b8562 100644 --- a/test/tool/perf_probe/indexing_native_probe_test.dart +++ b/test/tool/perf_probe/indexing_native_probe_test.dart @@ -6,6 +6,7 @@ import 'package:crypto/crypto.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/core/app_paths.dart'; import 'package:otzaria/data/data_providers/cache_database_holder.dart'; +import 'package:otzaria/data/book_identity.dart'; import 'package:otzaria/data/data_providers/tantivy_data_provider.dart'; import 'package:otzaria/indexing/models/index_update_mode.dart'; import 'package:otzaria/indexing/repository/indexing_repository.dart'; @@ -159,20 +160,59 @@ void main() { ); final expected = pdf ? 32 : 8000; expect(hits, hasLength(expected)); - final fingerprints = - (await engine.getBookFingerprints()).values - .map((v) => v.toString()) - .toList() - ..sort(); - expect(fingerprints, hasLength(8)); + final keysToTitles = { + for (final book in books) + BookIdentity.indexedFilePath(book): book.title, + }; + final fingerprints = await engine.getBookTextFingerprints(); + expect(fingerprints.keys.toSet(), keysToTitles.keys.toSet()); + final stamps = >[]; + for (final entry in keysToTitles.entries) { + final hash = fingerprints[entry.key]!; + expect(hash, greaterThan(BigInt.zero), reason: entry.value); + stamps.add([entry.value, hash.toString()]); + } + stamps.sort((a, b) => a.first.compareTo(b.first)); + final hitsPerBook = {}; + final canonicalHits = []; + for (final hit in hits) { + expect(keysToTitles[hit.filePath], hit.title); + expect(hit.textStatus, TextStatus.ok); + expect(hit.text, isNotEmpty); + expect(hit.isPdf, pdf); + hitsPerBook.update( + hit.title, + (count) => count + 1, + ifAbsent: () => 1, + ); + canonicalHits.add( + jsonEncode([ + hit.title, + hit.reference, + hit.text, + hit.isPdf, + hit.continuesToNextLine, + ]), + ); + } + expect(hitsPerBook.keys.toSet(), keysToTitles.values.toSet()); + expect(hitsPerBook.values, everyElement(expected ~/ 8)); + canonicalHits.sort(); rows.add({ 'case': kind, 'economy': economy, 'elapsedUs': watch.elapsedMicroseconds, 'documentsMatched': hits.length, 'books': result.indexedBooks, - 'fingerprintSha256': sha256 - .convert(utf8.encode(jsonEncode(fingerprints))) + 'textFingerprints': { + for (final stamp in stamps) stamp.first: stamp.last, + }, + 'textFingerprintSha256': sha256 + .convert(utf8.encode(jsonEncode(stamps))) + .toString(), + 'hitsPerBook': hitsPerBook, + 'hitContentSha256': sha256 + .convert(utf8.encode(jsonEncode(canonicalHits))) .toString(), 'rssBytesAfter': ProcessInfo.currentRss, 'peakRssBytesProcess': ProcessInfo.maxRss, @@ -184,7 +224,7 @@ void main() { } await File(output!).writeAsString( jsonEncode({ - 'schemaVersion': 1, + 'schemaVersion': 2, 'buildMode': 'flutter-test-debug/native-build-hook', 'os': Platform.operatingSystem, 'dartVersion': Platform.version, diff --git a/tool/perf_probe/run_indexing_pair.py b/tool/perf_probe/run_indexing_pair.py index 27b51849e7..64e54fd10a 100644 --- a/tool/perf_probe/run_indexing_pair.py +++ b/tool/perf_probe/run_indexing_pair.py @@ -18,6 +18,7 @@ "test/test_helpers/memory_cache_provider.dart"] CASES = {(kind, economy) for kind in ("txt", "docx", "pdf", "pdf-recovery") for economy in (False, True)} +BOOK_TITLES = {f"book{index}" for index in range(8)} def command(args, cwd, log=None, env=None): @@ -32,7 +33,7 @@ def command(args, cwd, log=None, env=None): def validate(report): - if report.get("schemaVersion") != 1: + if report.get("schemaVersion") != 2: raise ValueError("Unsupported or absent indexing report schema") keys = [(row["case"], row["economy"]) for row in report["rows"]] if len(keys) != len(CASES) or set(keys) != CASES: @@ -41,8 +42,22 @@ def validate(report): expected = 32 if row["case"].startswith("pdf") else 8000 if row["documentsMatched"] != expected or row["books"] != 8: raise ValueError("Incomplete indexed corpus") - if row["elapsedUs"] <= 0 or not re.fullmatch(r"[0-9a-f]{64}", row["fingerprintSha256"]): - raise ValueError("Invalid duration or content fingerprint") + if row["elapsedUs"] <= 0: + raise ValueError("Invalid duration") + stamps = row.get("textFingerprints", {}) + if set(stamps) != BOOK_TITLES or any( + not re.fullmatch(r"[1-9][0-9]*", value) or int(value) >= 2**64 + for value in stamps.values()): + raise ValueError("Missing, zero or invalid per-book text fingerprints") + digest = hashlib.sha256(json.dumps(sorted(stamps.items()), ensure_ascii=False, + separators=(",", ":")).encode("utf-8")).hexdigest() + if row.get("textFingerprintSha256") != digest: + raise ValueError("Per-book text fingerprint digest disagrees") + per_book = row.get("hitsPerBook", {}) + if set(per_book) != BOOK_TITLES or any(value != expected // 8 for value in per_book.values()): + raise ValueError("Missing or incomplete per-book matches") + if not re.fullmatch(r"[0-9a-f]{64}", row.get("hitContentSha256", "")): + raise ValueError("Missing canonical result content digest") for key in ("loadedEngineSha256", "pdfiumSha256"): if not re.fullmatch(r"[0-9a-f]{64}", report.get(key, "")): raise ValueError(f"Loaded native binary identity missing: {key}") @@ -64,13 +79,15 @@ def compare(samples): for kind, economy in sorted(CASES): by_role = {} fingerprints = set() + hit_contents = set() for role in ("baseline", "candidate"): rows = [row for sample in measured if sample["role"] == role for row in sample["report"]["rows"] if row["case"] == kind and row["economy"] == economy] if len(rows) < 5: raise ValueError("At least five measured repetitions per source required") - fingerprints.update(row["fingerprintSha256"] for row in rows) + fingerprints.update(row["textFingerprintSha256"] for row in rows) + hit_contents.update(row["hitContentSha256"] for row in rows) median = statistics.median(row["elapsedUs"] for row in rows) by_role[role] = {"medianMs": median / 1000, "documentsPerSecond": rows[0]["documentsMatched"] * 1_000_000 / median, @@ -79,6 +96,8 @@ def compare(samples): "samples": len(rows)} if len(fingerprints) != 1: raise ValueError(f"Indexed contents changed: {kind}, economy={economy}") + if len(hit_contents) != 1: + raise ValueError(f"Result contents changed: {kind}, economy={economy}") results.append({"case": kind, "economy": economy, **by_role, "durationRatio": by_role["candidate"]["medianMs"] / by_role["baseline"]["medianMs"]}) return results diff --git a/tool/perf_probe/test_indexing_pair.py b/tool/perf_probe/test_indexing_pair.py index 77205dd2b7..7654f31a0e 100644 --- a/tool/perf_probe/test_indexing_pair.py +++ b/tool/perf_probe/test_indexing_pair.py @@ -1,17 +1,24 @@ import copy +import hashlib +import json import unittest from tool.perf_probe.run_indexing_pair import CASES, compare, validate def fixture(): - return {"schemaVersion": 1, "manifest": {"txt": "abc"}, "buildMode": "test", + stamps = {f"book{index}": str(index + 1) for index in range(8)} + fingerprint = hashlib.sha256(json.dumps(sorted(stamps.items()), separators=(",", ":")).encode()).hexdigest() + return {"schemaVersion": 2, "manifest": {"txt": "abc"}, "buildMode": "test", "os": "windows", "dartVersion": "test", "processors": 8, "cacheState": "fresh", "loadedEnginePath": "engine", "loadedEngineSha256": "c" * 64, "pdfiumSha256": "d" * 64, "rows": [{"case": kind, "economy": economy, "elapsedUs": 1000, "documentsMatched": 32 if kind.startswith("pdf") else 8000, - "books": 8, "fingerprintSha256": "a" * 64, + "books": 8, "textFingerprints": dict(stamps), + "textFingerprintSha256": fingerprint, + "hitsPerBook": {title: 4 if kind.startswith("pdf") else 1000 for title in stamps}, + "hitContentSha256": "a" * 64, "rssBytesAfter": 10, "peakRssBytesProcess": 20} for kind, economy in sorted(CASES)]} @@ -44,7 +51,8 @@ def test_input_mode_or_fingerprint_changes_are_rejected(self): lambda r: r.update(manifest={"txt": "changed"}), lambda r: r.update(loadedEngineSha256="e" * 64), lambda r: r.update(pdfiumSha256="e" * 64), - lambda r: r["rows"][0].update(fingerprintSha256="b" * 64)]: + lambda r: r["rows"][0].update(hitContentSha256="b" * 64), + lambda r: r["rows"][0].update(textFingerprintSha256="b" * 64)]: samples = self.samples() mutate(samples[-1]["report"]) with self.assertRaises(ValueError): @@ -54,6 +62,26 @@ def test_too_few_repetitions_are_rejected(self): with self.assertRaises(ValueError): compare(self.samples()[:-2]) + def test_unverifiable_or_misassigned_book_contents_are_rejected(self): + for mutate in [lambda row: row["textFingerprints"].update(book0="0"), + lambda row: row["textFingerprints"].pop("book0"), + lambda row: row["hitsPerBook"].pop("book0"), + lambda row: row["hitsPerBook"].update(book0=0), + lambda row: row["textFingerprints"].update(book0="999")]: + report = fixture() + mutate(report["rows"][0]) + with self.assertRaises(ValueError): + validate(report) + + def test_changed_text_is_rejected_even_with_self_consistent_digest(self): + samples = self.samples() + row = samples[-1]["report"]["rows"][0] + row["textFingerprints"]["book0"] = "999" + row["textFingerprintSha256"] = hashlib.sha256(json.dumps( + sorted(row["textFingerprints"].items()), separators=(",", ":")).encode()).hexdigest() + with self.assertRaises(ValueError): + compare(samples) + if __name__ == "__main__": unittest.main() From 28908c7e616c3aafdcdd13035d6e0b83336d8963 Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 00:03:58 +0200 Subject: [PATCH 03/11] =?UTF-8?q?=D7=90=D7=99=D7=9E=D7=95=D7=AA=20=D7=91?= =?UTF-8?q?=D7=99=D7=A6=D7=95=D7=A2=D7=99=D7=9D:=20=D7=90=D7=99=D7=A0?= =?UTF-8?q?=D7=93=D7=95=D7=A7=D7=A1=20=D7=9E=D7=9C=D7=90,=20profile=20?= =?UTF-8?q?=D7=95=D6=BEPDF=20=D7=92=D7=93=D7=95=D7=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/perf_probe.yml | 11 +- .../indexing_native_probe_test.dart | 79 +++++ .../support/installed_plugin_pdf_fixture.dart | 14 +- .../database_library_provider.dart | 27 +- .../import_indexing_native_probe_test.dart | 320 ++++++++++++++++++ .../indexing_native_probe_test.dart | 14 +- .../installed_plugin_pdf_fixture_test.dart | 23 ++ test_driver/indexing_native_probe.dart | 3 + tool/perf_probe/run_indexing_pair.py | 43 ++- tool/perf_probe/test_indexing_pair.py | 46 ++- 10 files changed, 548 insertions(+), 32 deletions(-) create mode 100644 integration_test/indexing_native_probe_test.dart create mode 100644 test/tool/perf_probe/import_indexing_native_probe_test.dart create mode 100644 test_driver/indexing_native_probe.dart diff --git a/.github/workflows/perf_probe.yml b/.github/workflows/perf_probe.yml index 96920d8526..3def225ea9 100644 --- a/.github/workflows/perf_probe.yml +++ b/.github/workflows/perf_probe.yml @@ -8,6 +8,9 @@ on: - 'lib/utils/file/docx_cache.dart' - 'lib/utils/file/document_converter.dart' - 'test/tool/perf_probe/indexing_native_probe_test.dart' + - 'test/tool/perf_probe/import_indexing_native_probe_test.dart' + - 'integration_test/indexing_native_probe_test.dart' + - 'test_driver/indexing_native_probe.dart' - 'tool/perf_probe/run_indexing_pair.py' - 'tool/perf_probe/test_indexing_pair.py' - 'tool/perf_probe/verify_indexing_recovery_regression.py' @@ -100,7 +103,7 @@ concurrency: jobs: indexing_pair: - name: Native indexing pair (debug harness, same Windows host) + name: Native indexing pairs (debug and profile, same Windows host) needs: gate if: github.event_name == 'pull_request' && needs.gate.outputs.run == 'true' runs-on: windows-2025 @@ -129,8 +132,14 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } flutter test --no-pub --concurrency=1 --dart-define=OTZARIA_IMPORT_CACHE_BENCH=true test/migration/sync/external_book_conversion_benchmark_test.dart 2>&1 | Tee-Object -FilePath (Join-Path $env:RUNNER_TEMP 'indexing-pair/import-conversion.log') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $env:OTZARIA_IMPORT_INDEXING_PROBE_OUT = Join-Path $env:RUNNER_TEMP 'indexing-pair/import-indexing.json' + flutter test --no-pub --concurrency=1 test/tool/perf_probe/import_indexing_native_probe_test.dart 2>&1 | Tee-Object -FilePath (Join-Path $env:RUNNER_TEMP 'indexing-pair/import-indexing.log') + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Remove-Item Env:OTZARIA_IMPORT_INDEXING_PROBE_OUT python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair') --warmups 1 --repetitions 5 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair/profile') --mode profile --pdf-pages 600 --warmups 1 --repetitions 5 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Preserve raw timings, completeness and partial failures if: always() uses: actions/upload-artifact@v7.0.2 diff --git a/integration_test/indexing_native_probe_test.dart b/integration_test/indexing_native_probe_test.dart new file mode 100644 index 0000000000..a2969c4e12 --- /dev/null +++ b/integration_test/indexing_native_probe_test.dart @@ -0,0 +1,79 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; + +import '../test/tool/perf_probe/indexing_native_probe_test.dart' + as native_probe; + +void main() { + final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive; + final root = Platform.environment['OTZARIA_INDEXING_PROBE_ROOT']; + if (root != null) Directory.current = root; + final output = Platform.environment['OTZARIA_INDEXING_PROBE_OUT']; + final existedAtStart = output != null && File(output).existsSync(); + runApp(const SizedBox.shrink()); + native_probe.main(); + + // בדיקת test רגילה אינה נרשמת ב-results של מנהל בדיקות האינטגרציה. + testWidgets('native indexing report completed and verified', (tester) async { + expect(output, isNotNull, reason: 'Set OTZARIA_INDEXING_PROBE_OUT'); + expect(existedAtStart, isFalse, reason: 'Use a fresh output path'); + final file = File(output!); + expect( + await file.exists(), + isTrue, + reason: 'Native probe did not complete', + ); + final report = + jsonDecode(await file.readAsString()) as Map; + expect(report['schemaVersion'], 2); + final pdfPageCount = report['pdfPageCount'] as int; + expect(pdfPageCount, greaterThan(0)); + final rows = (report['rows'] as List).cast>(); + expect(rows, hasLength(8)); + final cases = {}; + final titles = {for (var i = 0; i < 8; i++) 'book$i'}; + for (final row in rows) { + cases.add('${row['case']}:${row['economy']}'); + expect(row['books'], 8); + final expectedHits = (row['case'] as String).startsWith('pdf') + ? 8 * pdfPageCount + : 8000; + expect(row['documentsMatched'], expectedHits); + expect(row['elapsedUs'], greaterThan(0)); + expect(row['segmentCount'], greaterThan(0)); + final stamps = (row['textFingerprints'] as Map).cast(); + expect(stamps.keys.toSet(), titles); + expect( + stamps.values.map(BigInt.parse), + everyElement(greaterThan(BigInt.zero)), + ); + final hits = row['hitsPerBook'] as Map; + expect(hits.keys.toSet(), titles); + expect(hits.values, everyElement(expectedHits ~/ 8)); + expect( + row['hitContentSha256'], + matches(RegExp(r'^[a-f0-9]{64}$')), + ); + } + expect(cases, { + for (final kind in ['txt', 'docx', 'pdf', 'pdf-recovery']) + for (final economy in [false, true]) '$kind:$economy', + }); + report['buildMode'] = kProfileMode + ? 'integration-test-profile-aot/native-build-hook' + : kReleaseMode + ? 'integration-test-release-aot/native-build-hook' + : 'integration-test-debug/native-build-hook'; + report['executionHarness'] = + 'minimal native window; no UI responsiveness measurement'; + await file.writeAsString(jsonEncode(report)); + binding.reportData = report; + await tester.pumpWidget(const SizedBox.shrink()); + }); +} diff --git a/integration_test/support/installed_plugin_pdf_fixture.dart b/integration_test/support/installed_plugin_pdf_fixture.dart index 29d999625a..0fc4034e73 100644 --- a/integration_test/support/installed_plugin_pdf_fixture.dart +++ b/integration_test/support/installed_plugin_pdf_fixture.dart @@ -12,15 +12,19 @@ const installedPdfQuery = 'bundleruntime'; String installedPdfPageToken(int pageNumber) => 'bundlepage$pageNumber'; /// מסמך קבוע עם טקסט ומלבן שחור; ללא גופני מערכת, תאריכים או רשת. -Uint8List createInstalledPdfFixture() { +Uint8List createInstalledPdfFixture({int? pageCount}) { + final count = pageCount ?? installedPdfPageSizes.length; + if (count <= 0) { + throw ArgumentError.value(pageCount, 'pageCount'); + } final objects = [ '<< /Type /Catalog /Pages 2 0 R >>', - '<< /Type /Pages /Count ${installedPdfPageSizes.length} /Kids [ ' - '${List.generate(installedPdfPageSizes.length, (i) => '${4 + i * 2} 0 R').join(' ')} ] >>', + '<< /Type /Pages /Count $count /Kids [ ' + '${List.generate(count, (i) => '${4 + i * 2} 0 R').join(' ')} ] >>', '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>', ]; - for (var i = 0; i < installedPdfPageSizes.length; i++) { - final size = installedPdfPageSizes[i]; + for (var i = 0; i < count; i++) { + final size = installedPdfPageSizes[i % installedPdfPageSizes.length]; final content = '1 g 0 0 ${size.width} ${size.height} re f 0 g\n' 'BT /F1 12 Tf 20 ${size.height - 30} Td ' diff --git a/lib/data/data_providers/database_library_provider.dart b/lib/data/data_providers/database_library_provider.dart index 4828ea43ec..8903cc73e9 100644 --- a/lib/data/data_providers/database_library_provider.dart +++ b/lib/data/data_providers/database_library_provider.dart @@ -445,15 +445,24 @@ Future>> scanExternalFolderForTest( String dbPath, { String? conversionCachePath, }) async { - await QueryLoader.initialize(); - final input = ( - folderPath: folderPath, - folderName: folderName, - dbPath: dbPath, - cachePath: conversionCachePath, - queries: QueryLoader.cacheSnapshot, - ); - final result = await Isolate.run(() => _scanExternalFolderWithCache(input)); + final List<_DiscoveredBook> result; + if (conversionCachePath == null) { + result = await _scanExternalFolderInIsolate(( + folderPath, + folderName, + dbPath, + )); + } else { + await QueryLoader.initialize(); + final input = ( + folderPath: folderPath, + folderName: folderName, + dbPath: dbPath, + cachePath: conversionCachePath, + queries: QueryLoader.cacheSnapshot, + ); + result = await Isolate.run(() => _scanExternalFolderWithCache(input)); + } return result .map((b) => {'path': b.book.filePath, 'existingBookId': b.existingBookId}) .toList(); diff --git a/test/tool/perf_probe/import_indexing_native_probe_test.dart b/test/tool/perf_probe/import_indexing_native_probe_test.dart new file mode 100644 index 0000000000..67ecc471b2 --- /dev/null +++ b/test/tool/perf_probe/import_indexing_native_probe_test.dart @@ -0,0 +1,320 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:crypto/crypto.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:otzaria/core/app_paths.dart'; +import 'package:otzaria/data/book_identity.dart'; +import 'package:otzaria/data/data_providers/cache_database_holder.dart'; +import 'package:otzaria/data/data_providers/tantivy_data_provider.dart'; +import 'package:otzaria/indexing/models/index_update_mode.dart'; +import 'package:otzaria/indexing/repository/indexing_repository.dart'; +import 'package:otzaria/library/models/library.dart'; +import 'package:otzaria/migration/database/daos/database.dart'; +import 'package:otzaria/migration/database/query_loader.dart'; +import 'package:otzaria/migration/database/repository/seforim_repository.dart'; +import 'package:otzaria/migration/services/external_book_import.dart'; +import 'package:otzaria/models/book_source.dart'; +import 'package:otzaria/models/books.dart'; +import 'package:otzaria/settings/engine/app_settings_store.dart'; +import 'package:otzaria/settings/engine/settings_repository.dart'; +import 'package:otzaria/utils/file/document_format.dart'; +import 'package:otzaria/utils/file/docx_cache.dart'; +import 'package:otzaria_search_engine/otzaria_search_engine.dart'; +import 'package:path/path.dart' as path; + +import '../../support/search_engine_test_init.dart'; +import '../../test_helpers/memory_cache_provider.dart'; +import '../../utils/file/docx_golden_fixtures.dart'; + +String _digest(Object value) => + sha256.convert(utf8.encode(jsonEncode(value))).toString(); + +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + final output = Platform.environment['OTZARIA_IMPORT_INDEXING_PROBE_OUT']; + test( + 'import cache policy through durable native indexing', + () async { + final paragraphs = int.parse( + Platform.environment['OTZARIA_IMPORT_INDEXING_LINES'] ?? '3000', + ); + expect(paragraphs, inInclusiveRange(1, 100000)); + const bookCount = 6; + final expectedHits = bookCount * paragraphs; + expect(await tryInitSearchEngine(), true, reason: searchEngineSkipReason); + await QueryLoader.initialize(); + final enginePath = File(searchEngineLoadedLibraryPath!); + final engineDigest = sha256 + .convert(await enginePath.readAsBytes()) + .toString(); + final root = await Directory.systemTemp.createTemp( + 'import-indexing-probe-', + ); + AppPaths.debugOverrideDataRootPath(root.path); + addTearDown(() async { + await CacheDatabaseHolder.instance.close(); + AppPaths.debugOverrideDataRootPath(null); + await root.delete(recursive: true); + }); + + final corpus = [ + for (var book = 0; book < bookCount; book++) + buildDocx( + document: documentXml( + styledPara('Heading1', 'פרק א') + + List.generate( + paragraphs, + (line) => para( + 'benchmarktoken ספר $book שורה $line עם תוכן עברי ארוך ' + 'מספיק לאינדוקס ובדיקת שלמות של הטקסט והמיקומים', + ), + ).join(), + ), + ), + ]; + expect(corpus.every((bytes) => bytes.length >= 8192), true); + final manifest = [ + for (final bytes in corpus) sha256.convert(bytes).toString(), + ]; + final rows = >[]; + String? oracleHits; + String? oracleFingerprints; + String? oracleToc; + String? oracleCache; + + for (var pass = 0; pass < 6; pass++) { + final order = pass.isEven ? [false, true] : [true, false]; + for (final primed in order) { + final directory = await Directory('${root.path}/$pass-$primed') + .create(); + await Settings.init(cacheProvider: MemoryCacheProvider()); + await Settings.setValue( + SettingsRepository.keyDatabasesPath, + directory.path, + ); + await Settings.setValue( + SettingsRepository.keyLibraryPath, + directory.path, + ); + final cachePath = '${directory.path}/cache.db'; + expect( + path.normalize(await CacheDatabaseHolder.resolveDbPath()), + path.normalize(cachePath), + ); + final index = await Directory('${directory.path}/index').create(); + final engine = await SearchEngine.newInstance(path: index.path); + final provider = TantivyDataProvider.forTesting(Future.value(engine)) + ..activeIndexPath = index.path + ..isInitialized.value = true; + TantivyDataProvider.instance = provider; + final repository = IndexingRepository( + provider, + indexUpdateMode: () => IndexUpdateMode.all, + ); + await repository.setEconomyIndexing(false); + final files = []; + final books = []; + for (var book = 0; book < corpus.length; book++) { + final file = await File('${directory.path}/book$book.docx') + .writeAsBytes(corpus[book]); + files.add(file); + books.add( + TextBook( + title: 'book$book', + filePath: file.path, + fileType: 'docx', + source: BookSource.user, + ), + ); + } + final library = Library(categories: [])..books.addAll(books); + final prepared = []; + Future prepare() async { + for (final file in files) { + prepared.add( + await PreparedExternalBook.prepare( + file.path, + await file.stat(), + DocumentFormat.docx, + ), + ); + } + } + + try { + final clock = Stopwatch()..start(); + if (primed) { + await withImportConversionCache(cachePath, prepare); + } else { + await prepare(); + } + final prepareUs = clock.elapsedMicroseconds; + final result = await repository.runIndexing( + library, + books: books, + onProgress: (_, _) {}, + ); + final indexUs = clock.elapsedMicroseconds - prepareUs; + await CacheDatabaseHolder.instance.close(); + clock.stop(); + final cacheCloseUs = + clock.elapsedMicroseconds - prepareUs - indexUs; + + expect(result.isClean, true, reason: '${result.failures}'); + expect(result.indexedBooks, bookCount); + final cachedTexts = >[]; + final cacheDatabase = MyDatabase.withPath(cachePath); + try { + final cacheRepository = SeforimRepository(cacheDatabase); + await cacheRepository.ensureInitialized(); + for (final file in files) { + final entry = await cacheRepository.getDocxTextCacheEntry( + '${file.path}#ooxml-without-images', + ); + expect(entry, isNotNull); + expect(entry!.text, isNotEmpty); + cachedTexts.add([ + file.uri.pathSegments.last, + sha256.convert(utf8.encode(entry.text)).toString(), + ]); + } + } finally { + await cacheDatabase.closeInBackground(); + } + final cacheDigest = _digest(cachedTexts); + final hits = await engine.searchExact( + query: 'benchmarktoken', + facets: const [], + limit: expectedHits + bookCount, + offset: 0, + order: ResultsOrder.catalogue, + matchNikud: false, + matchTaamim: false, + ); + expect(hits, hasLength(expectedHits)); + final keysToTitles = { + for (final book in books) + BookIdentity.indexedFilePath(book): book.title, + }; + final fingerprints = await engine.getBookTextFingerprints(); + expect(fingerprints.keys.toSet(), keysToTitles.keys.toSet()); + final stamps = >[]; + for (final entry in fingerprints.entries) { + expect(entry.value, greaterThan(BigInt.zero)); + stamps.add([keysToTitles[entry.key]!, entry.value.toString()]); + } + stamps.sort((a, b) => a.first.compareTo(b.first)); + final perBook = {}; + final canonicalHits = []; + for (final hit in hits) { + expect(hit.title, keysToTitles[hit.filePath]); + expect(hit.textStatus, TextStatus.ok); + expect(hit.text, isNotEmpty); + expect(hit.isPdf, false); + perBook.update( + hit.title, + (count) => count + 1, + ifAbsent: () => 1, + ); + canonicalHits.add( + jsonEncode([ + hit.title, + hit.reference, + hit.text, + hit.isPdf, + hit.continuesToNextLine, + ]), + ); + } + expect(perBook, { + for (final book in books) book.title: paragraphs, + }); + canonicalHits.sort(); + final hitDigest = _digest(canonicalHits); + final fingerprintDigest = _digest(stamps); + final tocDigest = _digest([ + for (final book in prepared) + [ + for (final entry in book.tocEntries ?? []) + [ + entry.text, + entry.level, + entry.lineIndex, + entry.parentId, + entry.hasChildren, + entry.isLastChild, + ], + ], + ]); + oracleHits ??= hitDigest; + oracleFingerprints ??= fingerprintDigest; + oracleToc ??= tocDigest; + oracleCache ??= cacheDigest; + expect(hitDigest, oracleHits); + expect(fingerprintDigest, oracleFingerprints); + expect(tocDigest, oracleToc); + expect(cacheDigest, oracleCache); + rows.add({ + 'pass': pass, + 'warmup': pass == 0, + 'primedImportCache': primed, + 'elapsedUs': clock.elapsedMicroseconds, + 'prepareUs': prepareUs, + 'indexUs': indexUs, + 'cacheCloseUs': cacheCloseUs, + 'paragraphsPerBook': paragraphs, + 'sourceBytes': [for (final bytes in corpus) bytes.length], + 'books': result.indexedBooks, + 'documentsMatched': hits.length, + 'hitsPerBook': perBook, + 'hitContentSha256': hitDigest, + 'textFingerprintSha256': fingerprintDigest, + 'textFingerprints': { + for (final stamp in stamps) stamp.first: stamp.last, + }, + 'tocSha256': tocDigest, + 'persistedCacheTextSha256': cacheDigest, + 'persistedCacheEntries': cachedTexts.length, + 'rssBytesAfter': ProcessInfo.currentRss, + 'peakRssBytesProcess': ProcessInfo.maxRss, + }); + } finally { + await engine.closeIndexWriter(); + engine.dispose(); + await CacheDatabaseHolder.instance.close(); + } + } + } + await File(output!).writeAsString( + jsonEncode({ + 'schemaVersion': 2, + 'comparison': 'within-candidate cache priming policy ablation; not immutable git baseline', + 'policy': 'scope primes metadata preparation only; indexing retains its ordinary asynchronous cache persistence in both policies', + 'buildMode': 'flutter-test-debug/native-build-hook', + 'scope': 'metadata preparation, repository indexing and cache durability; excludes fixture creation, discovery, UI and verification', + 'cacheState': + 'fresh files/index/cache per observation; OS cache uncontrolled', + 'economy': false, + 'paragraphsPerBook': paragraphs, + 'bookCount': bookCount, + 'sourceBytes': [for (final bytes in corpus) bytes.length], + 'warmupPasses': 1, + 'measuredPasses': 5, + 'order': 'alternating paired policy order, balanced across warmup and measured passes', + 'os': Platform.operatingSystem, + 'dartVersion': Platform.version, + 'processors': Platform.numberOfProcessors, + 'manifest': manifest, + 'loadedEnginePath': enginePath.absolute.path, + 'loadedEngineSha256': engineDigest, + 'rows': rows, + }), + ); + }, + skip: output == null + ? 'Set OTZARIA_IMPORT_INDEXING_PROBE_OUT to measure' + : false, + timeout: const Timeout(Duration(minutes: 20)), + ); +} diff --git a/test/tool/perf_probe/indexing_native_probe_test.dart b/test/tool/perf_probe/indexing_native_probe_test.dart index 28bb9b8562..bdb527fede 100644 --- a/test/tool/perf_probe/indexing_native_probe_test.dart +++ b/test/tool/perf_probe/indexing_native_probe_test.dart @@ -31,6 +31,10 @@ void main() { test( 'isolated native indexing measurement', () async { + final pdfPageCount = int.parse( + Platform.environment['OTZARIA_INDEXING_PROBE_PDF_PAGES'] ?? '4', + ); + expect(pdfPageCount, greaterThan(0)); expect(await tryInitSearchEngine(), true, reason: searchEngineSkipReason); final loadedEngine = File(searchEngineLoadedLibraryPath!); final loadedEngineDigest = sha256 @@ -97,7 +101,7 @@ void main() { ArchiveFile('word/document.xml', xml.length, xml)..lastModTime = 0, ); final bytes = pdf - ? createInstalledPdfFixture() + ? createInstalledPdfFixture(pageCount: pdfPageCount) : kind == 'docx' ? ZipEncoder().encode(archive) : utf8.encode(texts.join('\n')); @@ -149,16 +153,18 @@ void main() { watch.stop(); expect(result.isClean, true, reason: '${result.failures}'); expect(result.indexedBooks, 8); + final segmentCount = await engine.getSegmentCount(); + expect(segmentCount, greaterThan(0)); + final expected = pdf ? 8 * pdfPageCount : 8000; final hits = await engine.searchExact( query: pdf ? installedPdfQuery : 'benchmarktoken', facets: const [], - limit: 10000, + limit: expected, offset: 0, order: ResultsOrder.catalogue, matchNikud: false, matchTaamim: false, ); - final expected = pdf ? 32 : 8000; expect(hits, hasLength(expected)); final keysToTitles = { for (final book in books) @@ -204,6 +210,7 @@ void main() { 'elapsedUs': watch.elapsedMicroseconds, 'documentsMatched': hits.length, 'books': result.indexedBooks, + 'segmentCount': segmentCount, 'textFingerprints': { for (final stamp in stamps) stamp.first: stamp.last, }, @@ -225,6 +232,7 @@ void main() { await File(output!).writeAsString( jsonEncode({ 'schemaVersion': 2, + 'pdfPageCount': pdfPageCount, 'buildMode': 'flutter-test-debug/native-build-hook', 'os': Platform.operatingSystem, 'dartVersion': Platform.version, diff --git a/test/tool/perf_probe/installed_plugin_pdf_fixture_test.dart b/test/tool/perf_probe/installed_plugin_pdf_fixture_test.dart index 2c1bddd7e8..b881d06e19 100644 --- a/test/tool/perf_probe/installed_plugin_pdf_fixture_test.dart +++ b/test/tool/perf_probe/installed_plugin_pdf_fixture_test.dart @@ -46,8 +46,31 @@ void main() { test('fixture bytes are reproducible', () { final first = createInstalledPdfFixture(); expect(first, createInstalledPdfFixture()); + expect(first, createInstalledPdfFixture(pageCount: 4)); + expect(() => createInstalledPdfFixture(pageCount: 0), throwsArgumentError); }); + test( + 'extended fixture cycles page dimensions and preserves page tokens', + () async { + final document = await PdfDocument.openData( + createInstalledPdfFixture(pageCount: 6), + ); + addTearDown(document.dispose); + expect(document.pages, hasLength(6)); + for (var i = 0; i < document.pages.length; i++) { + final page = document.pages[i]; + final size = installedPdfPageSizes[i % installedPdfPageSizes.length]; + expect(page.width, size.width); + expect(page.height, size.height); + expect( + (await page.loadText())!.fullText, + contains(installedPdfPageToken(i + 1)), + ); + } + }, + ); + testWidgets('target readiness waits for the navigated viewport to paint', ( tester, ) async { diff --git a/test_driver/indexing_native_probe.dart b/test_driver/indexing_native_probe.dart new file mode 100644 index 0000000000..b38629cca9 --- /dev/null +++ b/test_driver/indexing_native_probe.dart @@ -0,0 +1,3 @@ +import 'package:integration_test/integration_test_driver.dart'; + +Future main() => integrationDriver(); diff --git a/tool/perf_probe/run_indexing_pair.py b/tool/perf_probe/run_indexing_pair.py index 64e54fd10a..b160f29e09 100644 --- a/tool/perf_probe/run_indexing_pair.py +++ b/tool/perf_probe/run_indexing_pair.py @@ -13,6 +13,8 @@ HARNESS = "test/tool/perf_probe/indexing_native_probe_test.dart" +PROFILE_TARGET = "integration_test/indexing_native_probe_test.dart" +PROFILE_DRIVER = "test_driver/indexing_native_probe.dart" SUPPORT = [HARNESS, "integration_test/support/installed_plugin_pdf_fixture.dart", "test/support/search_engine_test_init.dart", "test/test_helpers/memory_cache_provider.dart"] @@ -21,6 +23,15 @@ BOOK_TITLES = {f"book{index}" for index in range(8)} +def measurement_command(flutter, mode): + if mode == 'profile': + return [flutter, 'drive', '--profile', '-d', 'windows', '--no-pub', + '--target=' + PROFILE_TARGET, '--driver=' + PROFILE_DRIVER] + if mode != 'debug': + raise ValueError('Unsupported measurement mode') + return [flutter, 'test', '--no-pub', HARNESS, '--concurrency=1'] + + def command(args, cwd, log=None, env=None): process = subprocess.run(args, cwd=cwd, env=env, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -35,15 +46,20 @@ def command(args, cwd, log=None, env=None): def validate(report): if report.get("schemaVersion") != 2: raise ValueError("Unsupported or absent indexing report schema") + pdf_pages = report.get("pdfPageCount") + if type(pdf_pages) is not int or pdf_pages <= 0: + raise ValueError("Missing or invalid PDF page count") keys = [(row["case"], row["economy"]) for row in report["rows"]] if len(keys) != len(CASES) or set(keys) != CASES: raise ValueError("Missing, duplicated or unexpected indexing cases") for row in report["rows"]: - expected = 32 if row["case"].startswith("pdf") else 8000 + expected = 8 * pdf_pages if row["case"].startswith("pdf") else 8000 if row["documentsMatched"] != expected or row["books"] != 8: raise ValueError("Incomplete indexed corpus") if row["elapsedUs"] <= 0: raise ValueError("Invalid duration") + if type(row.get("segmentCount")) is not int or row["segmentCount"] <= 0: + raise ValueError("Missing or invalid committed segment count") stamps = row.get("textFingerprints", {}) if set(stamps) != BOOK_TITLES or any( not re.fullmatch(r"[1-9][0-9]*", value) or int(value) >= 2**64 @@ -70,7 +86,7 @@ def compare(samples): for sample in samples: report = sample["report"] validate(report) - for key in ("manifest", "buildMode", "os", "dartVersion", "processors", "cacheState", + for key in ("manifest", "buildMode", "pdfPageCount", "os", "dartVersion", "processors", "cacheState", "loadedEngineSha256", "pdfiumSha256"): if report[key] != reference[key]: raise ValueError(f"Non-comparable metadata: {key}") @@ -93,6 +109,7 @@ def compare(samples): "documentsPerSecond": rows[0]["documentsMatched"] * 1_000_000 / median, "rssBytesAfterMedian": statistics.median(row["rssBytesAfter"] for row in rows), "peakRssBytesProcessMedian": statistics.median(row["peakRssBytesProcess"] for row in rows), + "segmentCountMedian": statistics.median(row["segmentCount"] for row in rows), "samples": len(rows)} if len(fingerprints) != 1: raise ValueError(f"Indexed contents changed: {kind}, economy={economy}") @@ -110,12 +127,16 @@ def main(): parser.add_argument("--output", type=Path, required=True) parser.add_argument("--repetitions", type=int, default=5) parser.add_argument("--warmups", type=int, default=1) + parser.add_argument("--mode", choices=['debug', 'profile'], default='debug') + parser.add_argument("--pdf-pages", type=int, default=4) args = parser.parse_args() for commit in (args.baseline, args.candidate): if not re.fullmatch(r"[0-9a-f]{40}", commit): parser.error("Sources must be full immutable commit SHAs") if args.repetitions < 5 or args.warmups < 1: parser.error("Require at least five measured repetitions and one warmup") + if args.pdf_pages <= 0: + parser.error("PDF page count must be positive") root = Path(command(["git", "rev-parse", "--show-toplevel"], Path.cwd())) flutter = shutil.which("flutter.bat" if os.name == "nt" else "flutter") if not flutter: @@ -125,14 +146,15 @@ def main(): snapshots = {} samples = [] shared_engine = None - with tempfile.TemporaryDirectory(prefix="otzaria-indexing-pair-") as temporary: + with tempfile.TemporaryDirectory(prefix="otz-idx-", dir=os.environ.get('RUNNER_TEMP')) as temporary: scratch = Path(temporary) try: for role, commit in (("baseline", args.baseline), ("candidate", args.candidate)): checkout = scratch / role command(["git", "worktree", "add", "--detach", str(checkout), commit], root) snapshots[role] = checkout - for relative in SUPPORT: + support = SUPPORT + ([PROFILE_TARGET, PROFILE_DRIVER] if args.mode == 'profile' else []) + for relative in support: target = checkout / relative target.parent.mkdir(parents=True, exist_ok=True) shutil.copy2(root / relative, target) @@ -146,14 +168,18 @@ def main(): for role in order: name = f"{iteration:02}-{role}" raw = output / f"{name}.json" - env = dict(os.environ, OTZARIA_INDEXING_PROBE_OUT=str(raw)) + env = dict(os.environ, OTZARIA_INDEXING_PROBE_OUT=str(raw), + OTZARIA_INDEXING_PROBE_ROOT=str(snapshots[role]), + OTZARIA_INDEXING_PROBE_PDF_PAGES=str(args.pdf_pages)) if shared_engine: env.update(OTZARIA_SEARCH_ENGINE_LIBRARY_PATH=shared_engine[0], OTZARIA_EXPECTED_SEARCH_ENGINE_SHA256=shared_engine[1]) - command([flutter, "test", "--no-pub", HARNESS, "--concurrency=1"], + command(measurement_command(flutter, args.mode), snapshots[role], output / f"{name}.log", env) report = json.loads(raw.read_text(encoding="utf-8")) validate(report) + if report['pdfPageCount'] != args.pdf_pages: + raise ValueError('Measured PDF page count differs from requested experiment') if shared_engine is None: loaded = Path(report["loadedEnginePath"]) if not loaded.is_file(): @@ -166,9 +192,12 @@ def main(): "warmup": iteration < args.warmups, "report": report}) (output / "raw.json").write_text(json.dumps(samples, ensure_ascii=False, indent=2), encoding="utf-8") result = {"baseline": args.baseline, "candidate": args.candidate, + "measurementMode": args.mode, + "pdfPageCount": args.pdf_pages, "lockSha256": locks[0], "harnessSha256": hashlib.sha256((root / HARNESS).read_bytes()).hexdigest(), - "limitations": ["Flutter test debug harness; not release app performance", + "limitations": ["Flutter test debug harness; not release app performance" if args.mode == 'debug' + else "Flutter profile AOT in a minimal native window; not the full application UI", "OS caches uncontrolled; fresh app index/cache per case", "No UI frame or concurrent-search measurement", "Peak RSS is cumulative per process, not attributable to one case", diff --git a/tool/perf_probe/test_indexing_pair.py b/tool/perf_probe/test_indexing_pair.py index 7654f31a0e..23b6aeab48 100644 --- a/tool/perf_probe/test_indexing_pair.py +++ b/tool/perf_probe/test_indexing_pair.py @@ -3,31 +3,61 @@ import json import unittest -from tool.perf_probe.run_indexing_pair import CASES, compare, validate +from tool.perf_probe.run_indexing_pair import CASES, compare, measurement_command, validate -def fixture(): +def fixture(pdf_pages=4): stamps = {f"book{index}": str(index + 1) for index in range(8)} fingerprint = hashlib.sha256(json.dumps(sorted(stamps.items()), separators=(",", ":")).encode()).hexdigest() return {"schemaVersion": 2, "manifest": {"txt": "abc"}, "buildMode": "test", + "pdfPageCount": pdf_pages, "os": "windows", "dartVersion": "test", "processors": 8, "cacheState": "fresh", "loadedEnginePath": "engine", "loadedEngineSha256": "c" * 64, "pdfiumSha256": "d" * 64, "rows": [{"case": kind, "economy": economy, "elapsedUs": 1000, - "documentsMatched": 32 if kind.startswith("pdf") else 8000, - "books": 8, "textFingerprints": dict(stamps), + "documentsMatched": 8 * pdf_pages if kind.startswith("pdf") else 8000, + "books": 8, "segmentCount": 2, "textFingerprints": dict(stamps), "textFingerprintSha256": fingerprint, - "hitsPerBook": {title: 4 if kind.startswith("pdf") else 1000 for title in stamps}, + "hitsPerBook": {title: pdf_pages if kind.startswith("pdf") else 1000 for title in stamps}, "hitContentSha256": "a" * 64, "rssBytesAfter": 10, "peakRssBytesProcess": 20} for kind, economy in sorted(CASES)]} class IndexingPairTests(unittest.TestCase): - def samples(self): - return [{"role": role, "warmup": iteration == 0, "report": fixture()} + def test_profile_uses_native_drive_and_debug_uses_test(self): + profile = measurement_command('flutter', 'profile') + debug = measurement_command('flutter', 'debug') + self.assertEqual(profile[:5], ['flutter', 'drive', '--profile', '-d', 'windows']) + self.assertIn('--target=integration_test/indexing_native_probe_test.dart', profile) + self.assertIn('--driver=test_driver/indexing_native_probe.dart', profile) + self.assertEqual(debug[:2], ['flutter', 'test']) + with self.assertRaises(ValueError): + measurement_command('flutter', 'release') + + def samples(self, pdf_pages=4): + return [{"role": role, "warmup": iteration == 0, "report": fixture(pdf_pages)} for iteration in range(6) for role in ("baseline", "candidate")] + def test_pdf_page_count_requires_exact_per_book_results(self): + samples = self.samples(pdf_pages=600) + self.assertEqual(len(compare(samples)), 8) + for count in [None, 0, -1, True, 4.5, "600"]: + report = fixture() + report['pdfPageCount'] = count + with self.assertRaises(ValueError): + validate(report) + for field, value in [('documentsMatched', 32), + ('hitsPerBook', {f'book{i}': 4 for i in range(8)})]: + report = fixture(pdf_pages=600) + row = next(row for row in report['rows'] if row['case'] == 'pdf') + row[field] = value + with self.assertRaises(ValueError): + validate(report) + samples[-1]['report'] = fixture(pdf_pages=4) + with self.assertRaisesRegex(ValueError, 'pdfPageCount'): + compare(samples) + def test_complete_comparison_excludes_warmup(self): samples = self.samples() samples[0]["report"]["rows"][0]["elapsedUs"] = 1000000 @@ -40,6 +70,8 @@ def test_partial_duplicate_or_zero_time_is_rejected(self): for mutate in [lambda r: r["rows"].pop(), lambda r: r["rows"].append(copy.deepcopy(r["rows"][0])), lambda r: r["rows"][0].update(elapsedUs=0), + lambda r: r["rows"][0].update(segmentCount=0), + lambda r: r["rows"][0].update(segmentCount=True), lambda r: r["rows"][0].update(documentsMatched=0)]: report = fixture() mutate(report) From c5d057cae59f0eb774329e87415917da703cbcee Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 00:07:33 +0200 Subject: [PATCH 04/11] =?UTF-8?q?=D7=94=D7=A1=D7=A8=20=D7=A9=D7=99=D7=AA?= =?UTF-8?q?=D7=95=D7=A3=20=D7=94=D7=9E=D7=A8=D7=95=D7=AA=20=D7=A9=D7=9C?= =?UTF-8?q?=D7=90=20=D7=94=D7=95=D7=9B=D7=99=D7=97=20=D7=AA=D7=95=D7=A2?= =?UTF-8?q?=D7=9C=D7=AA=20=D7=91=D7=90=D7=99=D7=A0=D7=93=D7=95=D7=A7=D7=A1?= =?UTF-8?q?=20=D7=9E=D7=9C=D7=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/perf_probe.yml | 7 - .../indexing_native_probe_test.dart | 12 + .../database_library_provider.dart | 79 +--- .../services/external_book_import.dart | 12 +- .../sync/background_db_sync_worker.dart | 11 +- lib/utils/file/docx_cache.dart | 114 +---- ...ternal_book_conversion_benchmark_test.dart | 137 ------ .../external_book_conversion_cache_test.dart | 413 ------------------ .../import_indexing_native_probe_test.dart | 320 -------------- 9 files changed, 47 insertions(+), 1058 deletions(-) delete mode 100644 test/migration/sync/external_book_conversion_benchmark_test.dart delete mode 100644 test/migration/sync/external_book_conversion_cache_test.dart delete mode 100644 test/tool/perf_probe/import_indexing_native_probe_test.dart diff --git a/.github/workflows/perf_probe.yml b/.github/workflows/perf_probe.yml index 3def225ea9..d6580c579c 100644 --- a/.github/workflows/perf_probe.yml +++ b/.github/workflows/perf_probe.yml @@ -8,7 +8,6 @@ on: - 'lib/utils/file/docx_cache.dart' - 'lib/utils/file/document_converter.dart' - 'test/tool/perf_probe/indexing_native_probe_test.dart' - - 'test/tool/perf_probe/import_indexing_native_probe_test.dart' - 'integration_test/indexing_native_probe_test.dart' - 'test_driver/indexing_native_probe.dart' - 'tool/perf_probe/run_indexing_pair.py' @@ -130,12 +129,6 @@ jobs: if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } python -B tool/perf_probe/verify_indexing_recovery_regression.py --baseline $env:INDEX_BASELINE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair/regression') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - flutter test --no-pub --concurrency=1 --dart-define=OTZARIA_IMPORT_CACHE_BENCH=true test/migration/sync/external_book_conversion_benchmark_test.dart 2>&1 | Tee-Object -FilePath (Join-Path $env:RUNNER_TEMP 'indexing-pair/import-conversion.log') - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - $env:OTZARIA_IMPORT_INDEXING_PROBE_OUT = Join-Path $env:RUNNER_TEMP 'indexing-pair/import-indexing.json' - flutter test --no-pub --concurrency=1 test/tool/perf_probe/import_indexing_native_probe_test.dart 2>&1 | Tee-Object -FilePath (Join-Path $env:RUNNER_TEMP 'indexing-pair/import-indexing.log') - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - Remove-Item Env:OTZARIA_IMPORT_INDEXING_PROBE_OUT python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair') --warmups 1 --repetitions 5 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair/profile') --mode profile --pdf-pages 600 --warmups 1 --repetitions 5 diff --git a/integration_test/indexing_native_probe_test.dart b/integration_test/indexing_native_probe_test.dart index a2969c4e12..195c4343d5 100644 --- a/integration_test/indexing_native_probe_test.dart +++ b/integration_test/indexing_native_probe_test.dart @@ -2,9 +2,11 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; +import 'package:window_manager/window_manager.dart'; import '../test/tool/perf_probe/indexing_native_probe_test.dart' as native_probe; @@ -17,6 +19,16 @@ void main() { final output = Platform.environment['OTZARIA_INDEXING_PROBE_OUT']; final existedAtStart = output != null && File(output).existsSync(); runApp(const SizedBox.shrink()); + setUpAll(() async { + const timeout = Duration(seconds: 10); + await windowManager.ensureInitialized().timeout(timeout); + await windowManager.setSize(const Size(640, 480)).timeout(timeout); + await windowManager.show().timeout(timeout); + await const MethodChannel('otzaria/splash') + .invokeMethod('close') + .timeout(timeout); + expect(await windowManager.isVisible(), isTrue); + }); native_probe.main(); // בדיקת test רגילה אינה נרשמת ב-results של מנהל בדיקות האינטגרציה. diff --git a/lib/data/data_providers/database_library_provider.dart b/lib/data/data_providers/database_library_provider.dart index 8903cc73e9..f3c98c550c 100644 --- a/lib/data/data_providers/database_library_provider.dart +++ b/lib/data/data_providers/database_library_provider.dart @@ -1,5 +1,3 @@ -import 'package:otzaria/utils/file/docx_cache.dart'; - import 'dart:async'; import 'dart:collection'; import 'dart:io'; @@ -295,27 +293,6 @@ void _tryCreateBookFilePathIndex(sqlite3.Database reader, String dbPath) { } /// מסננת קבצים ללא שינוי ומכינה כותרות טקסטואליות מחוץ ל-UI isolate. -Future> _scanExternalFolderWithCache( - ({ - String folderPath, - String folderName, - String dbPath, - String? cachePath, - Map> queries, - }) - input, -) async { - QueryLoader.seedCache(input.queries); - return withImportConversionCache( - input.cachePath, - () => _scanExternalFolderInIsolate(( - input.folderPath, - input.folderName, - input.dbPath, - )), - ); -} - Future> _scanExternalFolderInIsolate( (String folderPath, String folderName, String dbPath) args, ) async { @@ -442,27 +419,13 @@ Future _collectBookFilesRecursive( Future>> scanExternalFolderForTest( String folderPath, String folderName, - String dbPath, { - String? conversionCachePath, -}) async { - final List<_DiscoveredBook> result; - if (conversionCachePath == null) { - result = await _scanExternalFolderInIsolate(( - folderPath, - folderName, - dbPath, - )); - } else { - await QueryLoader.initialize(); - final input = ( - folderPath: folderPath, - folderName: folderName, - dbPath: dbPath, - cachePath: conversionCachePath, - queries: QueryLoader.cacheSnapshot, - ); - result = await Isolate.run(() => _scanExternalFolderWithCache(input)); - } + String dbPath, +) async { + final result = await _scanExternalFolderInIsolate(( + folderPath, + folderName, + dbPath, + )); return result .map((b) => {'path': b.book.filePath, 'existingBookId': b.existingBookId}) .toList(); @@ -2510,16 +2473,15 @@ class DatabaseLibraryProvider implements LibraryProvider, LinkLinesProvider { ? trustedDbTarget(_sqliteProvider.dbPath) : null, UserBookSource() => null, - AttachedBookSource(:final slug) - when !AttachedLibraryRegistry.pathsPending => + AttachedBookSource(:final slug) when !AttachedLibraryRegistry.pathsPending => switch (AttachedLibraryRegistry.instance.libraryFor(slug)) { - final library? => ( - path: library.path, - untrusted: true, - immutable: library.immutable, - ), - null => null, - }, + final library? => ( + path: library.path, + untrusted: true, + immutable: library.immutable, + ), + null => null, + }, AttachedBookSource() => null, }; @@ -5841,17 +5803,8 @@ class DatabaseLibraryProvider implements LibraryProvider, LinkLinesProvider { // הוספת תיקייה משווה רק ל-user_books.db; האוסף כולו רץ ברקע. final dbPath = await UserBooksDatabaseHolder.resolveDbPath(); - final cachePath = await resolveImportConversionCachePath(); - await QueryLoader.initialize(); - final scanInput = ( - folderPath: folderPath, - folderName: folderName, - dbPath: dbPath, - cachePath: cachePath, - queries: QueryLoader.cacheSnapshot, - ); final discovered = await Isolate.run( - () => _scanExternalFolderWithCache(scanInput), + () => _scanExternalFolderInIsolate((folderPath, folderName, dbPath)), ); debugPrint( '📁 Isolate found ${discovered.length} books to process in $folderPath', diff --git a/lib/migration/services/external_book_import.dart b/lib/migration/services/external_book_import.dart index e0b7634e16..5fb4106393 100644 --- a/lib/migration/services/external_book_import.dart +++ b/lib/migration/services/external_book_import.dart @@ -7,7 +7,6 @@ import 'package:otzaria/migration/models/category.dart'; import 'package:otzaria/migration/models/topic.dart'; import 'package:otzaria/models/books.dart' as reader; import 'package:otzaria/utils/file/document_converter.dart'; -import 'package:otzaria/utils/file/docx_cache.dart'; import 'package:otzaria/utils/file/document_format.dart'; import 'package:otzaria/utils/file/toc_parser.dart'; import 'package:path/path.dart' as path; @@ -47,14 +46,7 @@ class PreparedExternalBook { tocEntries: format.isTextual ? externalBookTocEntries( TocParser.parseEntriesFromContent( - canCacheImportedDocument(stat.size) && - format.supportsImageFreeConversion - ? await convertDocumentForIndex( - File(filePath), - path.basenameWithoutExtension(filePath), - format, - ) - : await convertDocumentFile(filePath, embedImages: false), + await convertDocumentFile(filePath, embedImages: false), ), ) : null, @@ -122,7 +114,7 @@ Future prepareExternalBookInIsolate( FileStat stat, DocumentFormat format, ) async { - if (!format.isTextual || hasImportConversionCache) { + if (!format.isTextual) { return PreparedExternalBook.prepare(filePath, stat, format); } return Isolate.run( diff --git a/lib/migration/sync/background_db_sync_worker.dart b/lib/migration/sync/background_db_sync_worker.dart index 44532b2b19..c84111fb59 100644 --- a/lib/migration/sync/background_db_sync_worker.dart +++ b/lib/migration/sync/background_db_sync_worker.dart @@ -1,5 +1,3 @@ -import '../../utils/file/docx_cache.dart'; - import 'dart:async'; import 'dart:isolate'; @@ -56,9 +54,7 @@ Future runCustomFoldersDbSyncInIsolate({ // (קריאות dedup בלבד), ולכן החיבור הראשי אינו נסגר. return DatabaseLibraryProvider.operationQueue.enqueue(() async { await QueryLoader.initialize(); - final payload = buildPayload() - ..['cachePath'] = await resolveImportConversionCachePath(); - final resultMap = await _runWorkerIsolate(payload, isDelete: false); + final resultMap = await _runWorkerIsolate(buildPayload(), isDelete: false); return _resultFromMap(resultMap); }); } @@ -296,10 +292,7 @@ Future _withWorkerSyncService( ); try { - final cachePath = payload['cachePath'] as String?; - return cachePath == null - ? await body(service) - : await withImportConversionCache(cachePath, () => body(service)); + return await body(service); } finally { lineWriter.dispose(); database.close(); diff --git a/lib/utils/file/docx_cache.dart b/lib/utils/file/docx_cache.dart index 2b5cbeda22..ef1e0947cb 100644 --- a/lib/utils/file/docx_cache.dart +++ b/lib/utils/file/docx_cache.dart @@ -6,8 +6,6 @@ import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:otzaria/data/data_providers/cache_database_holder.dart'; import 'package:otzaria/migration/models/docx_text_cache_entry.dart'; -import 'package:otzaria/migration/database/daos/database.dart'; -import 'package:otzaria/migration/database/repository/seforim_repository.dart'; import 'package:otzaria/utils/file/docx_to_otzaria.dart'; import 'package:otzaria/utils/text/html_escape.dart'; import 'package:otzaria/utils/file/document_format.dart'; @@ -36,80 +34,7 @@ bool _shouldOpportunisticPrune() => _pruneSampler.nextInt(20) == 0; /// המרות פעילות לפי קובץ, גרסת ממיר ווריאנט פלט; מונע עבודה כפולה מקבילה /// לפני שהמטמון נכתב. -final Map> _inFlight = {}; - -final Object _importCacheKey = Object(); - -bool get hasImportConversionCache => Zone.current[_importCacheKey] != null; - -bool canCacheImportedDocument(int sourceBytes) { - final scope = Zone.current[_importCacheKey] as _ImportConversionCache?; - return scope != null && sourceBytes >= scope.minimumSourceBytes; -} - -Future resolveImportConversionCachePath() async { - try { - return await CacheDatabaseHolder.resolveDbPath(); - } catch (error) { - debugPrint('Document import cache unavailable: $error'); - return null; - } -} - -/// משתפת את מטמון ההמרה עם worker של ייבוא בנתיב שנפתר מראש. -Future withImportConversionCache( - String? databasePath, - Future Function() body, { - // במסמך זעיר פתיחת המטמון יקרה יותר מהמרה חוזרת באינדוקס. - int minimumSourceBytes = 8 * 1024, -}) async { - if (databasePath == null) return body(); - final scope = _ImportConversionCache(databasePath, minimumSourceBytes); - try { - return await runZoned(body, zoneValues: {_importCacheKey: scope}); - } finally { - await scope.close(); - } -} - -class _ImportConversionCache { - _ImportConversionCache(this.path, this.minimumSourceBytes); - - final String path; - final int minimumSourceBytes; - MyDatabase? database; - Future? _repository; - - Future get repository => _repository ??= _open(); - - Future _open() async { - final db = database = MyDatabase.withPath(path); - final repository = SeforimRepository(db); - await repository.ensureInitialized(); - return repository; - } - - Future close() async { - try { - await database?.backgroundWritesDone; - await database?.closeInBackground(); - } catch (error) { - debugPrint('Document import cache close failed: $error'); - } - } -} - -Future _finishCacheMaintenance(Future operation) async { - if (hasImportConversionCache) { - await operation; - } else { - unawaited(operation); - } -} - -Future _conversionCacheRepository() => - (Zone.current[_importCacheKey] as _ImportConversionCache?)?.repository ?? - CacheDatabaseHolder.instance.repository; +final Map> _inFlight = {}; /// ממיר מסמך Word מבוסס OOXML (DOCX/DOCM/DOTX/DOTM) לטקסט של אוצריא, עם /// מטמון מתמשך ב-`cache.db`. @@ -284,18 +209,18 @@ Future _convertWithCache( // ── נתיב cache-hit ────────────────────────────────────────────────────── try { - final repo = await _conversionCacheRepository(); + final repo = await CacheDatabaseHolder.instance.repository; final entry = await repo.getDocxTextCacheEntry(cachePath); if (entry != null && entry.isValidFor(size, mtime, converterVersion)) { final now = DateTime.now().millisecondsSinceEpoch; // throttle: touch לכל היותר פעם ביום (מונע כתיבת WAL בכל פתיחה). if (now - entry.accessedAt > _touchThrottleMs) { - await _finishCacheMaintenance( + unawaited( repo.touchDocxTextCacheEntry(cachePath, now).catchError((_) {}), ); } if (_shouldOpportunisticPrune()) { - await _finishCacheMaintenance( + unawaited( repo .pruneDocxTextCacheAccessedBefore( now - _conversionCacheTtl.inMilliseconds, @@ -311,13 +236,7 @@ Future _convertWithCache( // ── נתיב המרה ────────────────────────────────────────────────────────── // דה-דופ המרות מקבילות: אם כבר רצה המרה לאותו קובץ, נצרף אליה. - final key = ( - Zone.current[_importCacheKey], - cachePath, - size, - mtime, - converterVersion, - ); + final key = '$cachePath|$size|$mtime|$converterVersion'; final pending = _inFlight[key]; if (pending != null) { return _withFreshTitle(await pending, title); @@ -334,18 +253,15 @@ Future _convertWithCache( } // השמירה ב-isolate נמשכת שניות; עד סופה פתיחה נוספת מקבלת את הטקסט מכאן. - final persistence = _persist( - cachePath, - size, - mtime, - converterVersion, - text, - ).whenComplete(() => _inFlight.remove(key)); - if (hasImportConversionCache) { - await persistence; - } else { - unawaited(persistence); - } + unawaited( + _persist( + cachePath, + size, + mtime, + converterVersion, + text, + ).whenComplete(() => _inFlight.remove(key)), + ); return text; } @@ -372,7 +288,7 @@ Future _persist( String text, ) async { try { - final repo = await _conversionCacheRepository(); + final repo = await CacheDatabaseHolder.instance.repository; final now = DateTime.now().millisecondsSinceEpoch; await repo.upsertDocxTextCacheEntry( DocxTextCacheEntry( diff --git a/test/migration/sync/external_book_conversion_benchmark_test.dart b/test/migration/sync/external_book_conversion_benchmark_test.dart deleted file mode 100644 index f3b4c745ac..0000000000 --- a/test/migration/sync/external_book_conversion_benchmark_test.dart +++ /dev/null @@ -1,137 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'dart:isolate'; - -import 'package:crypto/crypto.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:otzaria/migration/database/query_loader.dart'; -import 'package:otzaria/migration/services/external_book_import.dart'; -import 'package:otzaria/utils/file/document_converter.dart'; -import 'package:otzaria/utils/file/document_format.dart'; -import 'package:otzaria/utils/file/docx_cache.dart'; -import 'package:path/path.dart' as path; - -import '../../utils/file/docx_golden_fixtures.dart'; - -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - test( - 'cold import plus indexing conversion benchmark', - () async { - final root = await Directory.systemTemp.createTemp( - 'import-cache-benchmark-', - ); - try { - await QueryLoader.initialize(); - final queries = QueryLoader.cacheSnapshot; - for (final lines in [20, 3000]) { - final files = []; - for (var i = 0; i < 6; i++) { - final file = File(path.join(root.path, 'book-$lines-$i.docx')); - await file.writeAsBytes( - buildDocx( - document: documentXml( - styledPara('Heading1', 'פרק א') + - List.generate( - lines, - (j) => para('תוכן עברי לבדיקה $i $j'), - ).join(), - ), - ), - ); - files.add(file.path); - } - final sourceBytes = await Future.wait( - files.map((file) => File(file).length()), - ); - List? oracle; - for (var run = 0; run < 6; run++) { - for (final cached in run.isEven ? [false, true] : [true, false]) { - final cachePath = path.join( - root.path, - 'cache-$lines-$run-$cached.db', - ); - final clock = Stopwatch()..start(); - final tocHashes = await Isolate.run(() async { - QueryLoader.seedCache(queries); - Future> prepare() async => [ - for (final file in files) - sha256 - .convert( - utf8.encode( - jsonEncode([ - for (final entry - in (await PreparedExternalBook.prepare( - file, - await File(file).stat(), - DocumentFormat.docx, - )).tocEntries!) - [ - entry.text, - entry.level, - entry.lineIndex, - entry.parentId, - ], - ]), - ), - ) - .toString(), - ]; - return cached - ? withImportConversionCache(cachePath, prepare) - : prepare(); - }); - final importMs = clock.elapsedMilliseconds; - final textHashes = await Isolate.run(() async { - QueryLoader.seedCache(queries); - return withImportConversionCache( - cachePath, - () async => [ - for (final file in files) - sha256 - .convert( - utf8.encode( - await convertDocumentForIndex( - File(file), - path.basenameWithoutExtension(file), - DocumentFormat.docx, - ), - ), - ) - .toString(), - ], - ); - }); - final hashes = [...tocHashes, ...textHashes]; - oracle ??= hashes; - expect( - hashes, - oracle, - reason: 'All TOC and indexed text must match', - ); - // This measures conversion/preparation, not native index construction. - debugPrint( - 'IMPORT_CONVERSION_BENCH ${jsonEncode({ - 'linesPerBook': lines, - 'books': files.length, - 'sourceBytes': sourceBytes, - 'scope': 'conversion-and-durable-cache-only', - 'run': run, - 'warmup': run == 0, - 'cachedImport': cached, - 'importMs': importMs, - 'totalMs': clock.elapsedMilliseconds, - })}', - ); - } - } - } - } finally { - await root.delete(recursive: true); - } - }, - skip: !const bool.fromEnvironment('OTZARIA_IMPORT_CACHE_BENCH'), - timeout: const Timeout(Duration(minutes: 15)), - ); -} diff --git a/test/migration/sync/external_book_conversion_cache_test.dart b/test/migration/sync/external_book_conversion_cache_test.dart deleted file mode 100644 index 4ddf3fa850..0000000000 --- a/test/migration/sync/external_book_conversion_cache_test.dart +++ /dev/null @@ -1,413 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; -import 'dart:isolate'; -import 'dart:math'; - -import 'package:archive/archive.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:otzaria/data/data_providers/database_library_provider.dart'; -import 'package:otzaria/migration/database/daos/database.dart'; -import 'package:otzaria/migration/database/query_loader.dart'; -import 'package:otzaria/migration/database/repository/seforim_repository.dart'; -import 'package:otzaria/migration/services/external_book_import.dart'; -import 'package:otzaria/migration/sync/background_db_sync_worker.dart'; -import 'package:otzaria/settings/engine/app_settings_store.dart'; -import 'package:otzaria/settings/engine/settings_repository.dart'; -import 'package:otzaria/settings/services/custom_folders/custom_folder.dart'; -import 'package:otzaria/utils/file/document_converter.dart'; -import 'package:otzaria/utils/file/document_format.dart'; -import 'package:otzaria/utils/file/docx_cache.dart'; -import 'package:otzaria/utils/file/toc_parser.dart'; -import 'package:path/path.dart' as path; - -import '../../utils/file/docx_golden_fixtures.dart'; -import '../../test_helpers/memory_cache_provider.dart'; -import '../../../tool/src/document_fixtures/word_binary_builder.dart'; - -List _archive(Map entries) { - final archive = Archive(); - for (final entry in entries.entries) { - final bytes = utf8.encode(entry.value); - archive.addFile(ArchiveFile(entry.key, bytes.length, bytes)); - } - return ZipEncoder().encode(archive); -} - -List _largeDocx() { - final random = Random(6187); - final body = List.generate(800, (index) { - final text = String.fromCharCodes( - List.generate(40, (_) => 65 + random.nextInt(26)), - ); - return para('$index $text'); - }).join(); - return buildDocx(document: documentXml(body)); -} - -List _additionalFixture(DocumentFormat format) => switch (format) { - DocumentFormat.doc || - DocumentFormat.dot || - DocumentFormat.wbk => buildWordBinary([ - const WordPiece('שלום עולם\rתוכן הספר\r'), - ], template: format == DocumentFormat.dot), - DocumentFormat.rtf => utf8.encode( - r'{\rtf1\ansi\par Sample paragraph\par More text}', - ), - DocumentFormat.xml => utf8.encode( - '' - 'שלום עולם', - ), - DocumentFormat.odt => _archive({ - 'mimetype': 'application/vnd.oasis.opendocument.text', - 'content.xml': - '' - 'פרק א' - 'תוכן עברי', - }), - DocumentFormat.epub => _archive({ - 'mimetype': 'application/epub+zip', - 'META-INF/container.xml': - '' - '' - '', - 'content.opf': - '' - 'ספר' - '' - '', - 'chapter.xhtml': - '

פרק א

' - '

תוכן עברי

', - }), - _ => throw ArgumentError.value(format), -}; - -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - late Directory root; - late String cachePath; - late Map> queries; - - setUp(() async { - root = await Directory.systemTemp.createTemp('import-conversion-cache-'); - cachePath = path.join(root.path, 'custom-cache.db'); - await QueryLoader.initialize(); - queries = QueryLoader.cacheSnapshot; - }); - - tearDown(() async => root.delete(recursive: true)); - - List toc(PreparedExternalBook book) => [ - for (final entry in book.tocEntries ?? []) - ( - entry.text, - entry.level, - entry.lineIndex, - entry.parentId, - entry.hasChildren, - entry.isLastChild, - ), - ]; - - Future import(File file, DocumentFormat format) async { - final filePath = file.path; - final stat = await file.stat(); - final dbPath = cachePath; - final querySnapshot = queries; - return Isolate.run(() async { - QueryLoader.seedCache(querySnapshot); - return withImportConversionCache( - dbPath, - () => prepareExternalBookInIsolate(filePath, stat, format), - minimumSourceBytes: 0, - ); - }); - } - - Future cachedText(String key) async { - final database = MyDatabase.withPath(cachePath); - try { - final repository = SeforimRepository(database); - await repository.ensureInitialized(); - return (await repository.getDocxTextCacheEntry(key))?.text; - } finally { - database.close(); - } - } - - for (final format in [ - DocumentFormat.epub, - DocumentFormat.odt, - DocumentFormat.rtf, - DocumentFormat.xml, - DocumentFormat.doc, - DocumentFormat.dot, - DocumentFormat.wbk, - ]) { - test('שקילות ייבוא ואינדוקס בפורמט $format', () async { - final file = File(path.join(root.path, 'ספר.${format.extension}')); - await file.writeAsBytes(_additionalFixture(format)); - final canonical = await convertDocumentFile( - file.path, - embedImages: false, - ); - final baseline = await PreparedExternalBook.prepare( - file.path, - await file.stat(), - format, - ); - final prepared = await import(file, format); - expect(toc(prepared), toc(baseline)); - final indexed = await withImportConversionCache( - cachePath, - () => convertDocumentForIndex(file, 'ספר', format), - ); - expect(indexed, canonical); - expect(await File(cachePath).exists(), isTrue); - }); - } - - test( - 'אינדוקס אחרי יציאת worker משתמש בתוצאה השמורה ללא המרה חוזרת', - () async { - final file = File(path.join(root.path, 'ספר.docx')); - final bytes = buildDocx( - document: documentXml(styledPara('Heading1', 'פרק א') + para('תוכן')), - ); - await file.writeAsBytes(bytes); - final canonical = await convertDocumentFile( - file.path, - embedImages: false, - ); - await import(file, DocumentFormat.docx); - final stat = await file.stat(); - // אותו מפתח תוקף, אבל הממיר אינו מסוגל לקרוא את המקור — הצלחה מוכיחה cache-hit. - await file.writeAsBytes(List.filled(bytes.length, 0)); - await file.setLastModified(stat.modified); - final indexed = await withImportConversionCache( - cachePath, - () => convertDocumentForIndex(file, 'ספר', DocumentFormat.docx), - ); - expect(indexed, canonical); - }, - ); - - test('worker הסנכרון האמיתי כותב למטמון שבנתיב ההגדרות המבודד', () async { - await Settings.init(cacheProvider: MemoryCacheProvider()); - await Settings.setValue(SettingsRepository.keyDatabasesPath, root.path); - cachePath = path.join(root.path, 'cache.db'); - final officialPath = path.join(root.path, 'official.db'); - final userPath = path.join(root.path, 'user_books.db'); - for (final dbPath in [officialPath, userPath]) { - final db = MyDatabase.withPath(dbPath); - try { - await SeforimRepository(db).ensureInitialized(); - } finally { - await db.closeInBackground(); - } - } - final folder = await Directory(path.join(root.path, 'books')).create(); - final file = File(path.join(folder.path, 'ספר.docx')); - await file.writeAsBytes(_largeDocx()); - expect((await file.stat()).size, greaterThanOrEqualTo(8192)); - final result = await runCustomFoldersDbSyncInIsolate( - dbPath: officialPath, - userBooksDbPath: userPath, - customFolders: [ - CustomFolder( - path: folder.path, - addToDatabase: false, - addedAt: DateTime(2026), - ), - ], - ); - expect(result.errors, isEmpty); - expect(result.addedBooks, 1); - expect( - await cachedText('${file.path}#ooxml-without-images'), - await convertDocumentFile(file.path, embedImages: false), - ); - }); - - test('סורק ההוספה משתמש במטמון ב-worker ושומר תוצאה לפני החזרה', () async { - final folder = await Directory(path.join(root.path, 'scan')).create(); - final file = File(path.join(folder.path, 'ספר.docx')); - await file.writeAsBytes(_largeDocx()); - expect((await file.stat()).size, greaterThanOrEqualTo(8192)); - final discovered = await scanExternalFolderForTest( - folder.path, - 'תיקייה', - path.join(root.path, 'missing-user.db'), - conversionCachePath: cachePath, - ); - expect(discovered.single['path'], file.path); - expect( - await cachedText('${file.path}#ooxml-without-images'), - await convertDocumentFile(file.path, embedImages: false), - ); - }); - - for (final format in [ - DocumentFormat.docx, - DocumentFormat.docm, - DocumentFormat.dotx, - DocumentFormat.dotm, - DocumentFormat.html, - DocumentFormat.htm, - DocumentFormat.xhtml, - ]) { - test('ייבוא $format שומר פלט שקול במטמון לפני יציאת worker', () async { - final file = File(path.join(root.path, 'ספר.${format.extension}')); - if (format.isOoxmlWord) { - await file.writeAsBytes( - buildDocx( - document: documentXml( - styledPara('Heading1', 'פרק א') + para('תוכן עברי'), - ), - ), - ); - } else { - await file.writeAsString( - '

פרק א

' - '

תוכן עברי

', - ); - } - final canonical = await convertDocumentFile( - file.path, - embedImages: false, - ); - final baseline = await PreparedExternalBook.prepare( - file.path, - await file.stat(), - format, - ); - final prepared = await import(file, format); - expect(toc(prepared), toc(baseline)); - final variant = format.isOoxmlWord - ? 'ooxml-without-images' - : 'html-without-images'; - expect(await cachedText('${file.path}#$variant'), canonical); - // המטמון משמש את האינדוקס אחרי שה-worker שכתב אותו הסתיים. - final indexed = await withImportConversionCache( - cachePath, - () => convertDocumentForIndex(file, 'ספר', format), - ); - expect(indexed, canonical); - expect( - externalBookTocEntries(TocParser.parseEntriesFromContent(indexed)) - .map((e) => e.lineIndex), - prepared.tocEntries!.map((e) => e.lineIndex), - ); - }); - } - - test('שינוי מסמך מחליף את המטמון ואת תוכן העניינים', () async { - final file = File(path.join(root.path, 'ספר.html')); - await file.writeAsString('

ראשון

תוכן

'); - final first = await import(file, DocumentFormat.html); - await file.writeAsString('

פרק חדש וארוך

תוכן שונה

'); - final second = await import(file, DocumentFormat.html); - expect(toc(second), isNot(toc(first))); - expect( - await cachedText('${file.path}#html-without-images'), - await convertDocumentFile(file.path, embedImages: false), - ); - }); - - test('מטמון שאינו כתיב אינו מונע ייבוא ואינו משנה כותרות', () async { - final file = await File(path.join(root.path, 'ספר.html')) - .writeAsString('

פרק

תוכן

'); - final baseline = await PreparedExternalBook.prepare( - file.path, - await file.stat(), - DocumentFormat.html, - ); - cachePath = root.path; - expect(toc(await import(file, DocumentFormat.html)), toc(baseline)); - }); - - test('טקסט רגיל ו-Markdown אינם יוצרים מטמון מסמכים', () async { - for (final format in [DocumentFormat.txt, DocumentFormat.md]) { - final file = await File(path.join(root.path, 'ספר.${format.extension}')) - .writeAsString('# כותרת\nתוכן'); - final baseline = await PreparedExternalBook.prepare( - file.path, - await file.stat(), - format, - ); - expect(toc(await import(file, format)), toc(baseline)); - } - expect(await File(cachePath).exists(), isFalse); - }); - - test('ייבואים מקבילים לאותו קובץ שומרים כל מטמון בנתיבו', () async { - final file = await File(path.join(root.path, 'shared.html')) - .writeAsString('

פרק

תוכן

'); - final stat = await file.stat(); - final secondCache = path.join(root.path, 'second-cache.db'); - final prepared = await Future.wait([ - for (final target in [cachePath, secondCache]) - withImportConversionCache( - target, - () => PreparedExternalBook.prepare( - file.path, - stat, - DocumentFormat.html, - ), - minimumSourceBytes: 0, - ), - ]); - expect(toc(prepared.first), toc(prepared.last)); - final expected = await cachedText('${file.path}#html-without-images'); - expect(expected, isNotNull); - cachePath = secondCache; - expect(await cachedText('${file.path}#html-without-images'), expected); - }); - - test('סף ברירת המחדל הוא 8KiB ואינו פותח מטמון ללא המרה', () async { - expect(canCacheImportedDocument(8192), isFalse); - await withImportConversionCache(cachePath, () async { - expect(canCacheImportedDocument(8191), isFalse); - expect(canCacheImportedDocument(8192), isTrue); - expect(canCacheImportedDocument(8193), isTrue); - }); - expect(await File(cachePath).exists(), isFalse); - }); - - for (final large in [false, true]) { - test( - 'הכנת DOCX ${large ? 'גדול' : 'קטן'} מכבדת את סף ברירת המחדל', - () async { - final file = File(path.join(root.path, 'ספר.docx')); - await file.writeAsBytes( - large ? _largeDocx() : buildDocx(document: documentXml(para('תוכן'))), - ); - final stat = await file.stat(); - expect(stat.size >= 8192, large); - final baseline = await PreparedExternalBook.prepare( - file.path, - stat, - DocumentFormat.docx, - ); - final prepared = await withImportConversionCache( - cachePath, - () => PreparedExternalBook.prepare( - file.path, - stat, - DocumentFormat.docx, - ), - ); - expect(toc(prepared), toc(baseline)); - expect(await File(cachePath).exists(), large); - if (large) { - expect( - await cachedText('${file.path}#ooxml-without-images'), - await convertDocumentFile(file.path, embedImages: false), - ); - } - }, - ); - } -} diff --git a/test/tool/perf_probe/import_indexing_native_probe_test.dart b/test/tool/perf_probe/import_indexing_native_probe_test.dart deleted file mode 100644 index 67ecc471b2..0000000000 --- a/test/tool/perf_probe/import_indexing_native_probe_test.dart +++ /dev/null @@ -1,320 +0,0 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:crypto/crypto.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:otzaria/core/app_paths.dart'; -import 'package:otzaria/data/book_identity.dart'; -import 'package:otzaria/data/data_providers/cache_database_holder.dart'; -import 'package:otzaria/data/data_providers/tantivy_data_provider.dart'; -import 'package:otzaria/indexing/models/index_update_mode.dart'; -import 'package:otzaria/indexing/repository/indexing_repository.dart'; -import 'package:otzaria/library/models/library.dart'; -import 'package:otzaria/migration/database/daos/database.dart'; -import 'package:otzaria/migration/database/query_loader.dart'; -import 'package:otzaria/migration/database/repository/seforim_repository.dart'; -import 'package:otzaria/migration/services/external_book_import.dart'; -import 'package:otzaria/models/book_source.dart'; -import 'package:otzaria/models/books.dart'; -import 'package:otzaria/settings/engine/app_settings_store.dart'; -import 'package:otzaria/settings/engine/settings_repository.dart'; -import 'package:otzaria/utils/file/document_format.dart'; -import 'package:otzaria/utils/file/docx_cache.dart'; -import 'package:otzaria_search_engine/otzaria_search_engine.dart'; -import 'package:path/path.dart' as path; - -import '../../support/search_engine_test_init.dart'; -import '../../test_helpers/memory_cache_provider.dart'; -import '../../utils/file/docx_golden_fixtures.dart'; - -String _digest(Object value) => - sha256.convert(utf8.encode(jsonEncode(value))).toString(); - -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - final output = Platform.environment['OTZARIA_IMPORT_INDEXING_PROBE_OUT']; - test( - 'import cache policy through durable native indexing', - () async { - final paragraphs = int.parse( - Platform.environment['OTZARIA_IMPORT_INDEXING_LINES'] ?? '3000', - ); - expect(paragraphs, inInclusiveRange(1, 100000)); - const bookCount = 6; - final expectedHits = bookCount * paragraphs; - expect(await tryInitSearchEngine(), true, reason: searchEngineSkipReason); - await QueryLoader.initialize(); - final enginePath = File(searchEngineLoadedLibraryPath!); - final engineDigest = sha256 - .convert(await enginePath.readAsBytes()) - .toString(); - final root = await Directory.systemTemp.createTemp( - 'import-indexing-probe-', - ); - AppPaths.debugOverrideDataRootPath(root.path); - addTearDown(() async { - await CacheDatabaseHolder.instance.close(); - AppPaths.debugOverrideDataRootPath(null); - await root.delete(recursive: true); - }); - - final corpus = [ - for (var book = 0; book < bookCount; book++) - buildDocx( - document: documentXml( - styledPara('Heading1', 'פרק א') + - List.generate( - paragraphs, - (line) => para( - 'benchmarktoken ספר $book שורה $line עם תוכן עברי ארוך ' - 'מספיק לאינדוקס ובדיקת שלמות של הטקסט והמיקומים', - ), - ).join(), - ), - ), - ]; - expect(corpus.every((bytes) => bytes.length >= 8192), true); - final manifest = [ - for (final bytes in corpus) sha256.convert(bytes).toString(), - ]; - final rows = >[]; - String? oracleHits; - String? oracleFingerprints; - String? oracleToc; - String? oracleCache; - - for (var pass = 0; pass < 6; pass++) { - final order = pass.isEven ? [false, true] : [true, false]; - for (final primed in order) { - final directory = await Directory('${root.path}/$pass-$primed') - .create(); - await Settings.init(cacheProvider: MemoryCacheProvider()); - await Settings.setValue( - SettingsRepository.keyDatabasesPath, - directory.path, - ); - await Settings.setValue( - SettingsRepository.keyLibraryPath, - directory.path, - ); - final cachePath = '${directory.path}/cache.db'; - expect( - path.normalize(await CacheDatabaseHolder.resolveDbPath()), - path.normalize(cachePath), - ); - final index = await Directory('${directory.path}/index').create(); - final engine = await SearchEngine.newInstance(path: index.path); - final provider = TantivyDataProvider.forTesting(Future.value(engine)) - ..activeIndexPath = index.path - ..isInitialized.value = true; - TantivyDataProvider.instance = provider; - final repository = IndexingRepository( - provider, - indexUpdateMode: () => IndexUpdateMode.all, - ); - await repository.setEconomyIndexing(false); - final files = []; - final books = []; - for (var book = 0; book < corpus.length; book++) { - final file = await File('${directory.path}/book$book.docx') - .writeAsBytes(corpus[book]); - files.add(file); - books.add( - TextBook( - title: 'book$book', - filePath: file.path, - fileType: 'docx', - source: BookSource.user, - ), - ); - } - final library = Library(categories: [])..books.addAll(books); - final prepared = []; - Future prepare() async { - for (final file in files) { - prepared.add( - await PreparedExternalBook.prepare( - file.path, - await file.stat(), - DocumentFormat.docx, - ), - ); - } - } - - try { - final clock = Stopwatch()..start(); - if (primed) { - await withImportConversionCache(cachePath, prepare); - } else { - await prepare(); - } - final prepareUs = clock.elapsedMicroseconds; - final result = await repository.runIndexing( - library, - books: books, - onProgress: (_, _) {}, - ); - final indexUs = clock.elapsedMicroseconds - prepareUs; - await CacheDatabaseHolder.instance.close(); - clock.stop(); - final cacheCloseUs = - clock.elapsedMicroseconds - prepareUs - indexUs; - - expect(result.isClean, true, reason: '${result.failures}'); - expect(result.indexedBooks, bookCount); - final cachedTexts = >[]; - final cacheDatabase = MyDatabase.withPath(cachePath); - try { - final cacheRepository = SeforimRepository(cacheDatabase); - await cacheRepository.ensureInitialized(); - for (final file in files) { - final entry = await cacheRepository.getDocxTextCacheEntry( - '${file.path}#ooxml-without-images', - ); - expect(entry, isNotNull); - expect(entry!.text, isNotEmpty); - cachedTexts.add([ - file.uri.pathSegments.last, - sha256.convert(utf8.encode(entry.text)).toString(), - ]); - } - } finally { - await cacheDatabase.closeInBackground(); - } - final cacheDigest = _digest(cachedTexts); - final hits = await engine.searchExact( - query: 'benchmarktoken', - facets: const [], - limit: expectedHits + bookCount, - offset: 0, - order: ResultsOrder.catalogue, - matchNikud: false, - matchTaamim: false, - ); - expect(hits, hasLength(expectedHits)); - final keysToTitles = { - for (final book in books) - BookIdentity.indexedFilePath(book): book.title, - }; - final fingerprints = await engine.getBookTextFingerprints(); - expect(fingerprints.keys.toSet(), keysToTitles.keys.toSet()); - final stamps = >[]; - for (final entry in fingerprints.entries) { - expect(entry.value, greaterThan(BigInt.zero)); - stamps.add([keysToTitles[entry.key]!, entry.value.toString()]); - } - stamps.sort((a, b) => a.first.compareTo(b.first)); - final perBook = {}; - final canonicalHits = []; - for (final hit in hits) { - expect(hit.title, keysToTitles[hit.filePath]); - expect(hit.textStatus, TextStatus.ok); - expect(hit.text, isNotEmpty); - expect(hit.isPdf, false); - perBook.update( - hit.title, - (count) => count + 1, - ifAbsent: () => 1, - ); - canonicalHits.add( - jsonEncode([ - hit.title, - hit.reference, - hit.text, - hit.isPdf, - hit.continuesToNextLine, - ]), - ); - } - expect(perBook, { - for (final book in books) book.title: paragraphs, - }); - canonicalHits.sort(); - final hitDigest = _digest(canonicalHits); - final fingerprintDigest = _digest(stamps); - final tocDigest = _digest([ - for (final book in prepared) - [ - for (final entry in book.tocEntries ?? []) - [ - entry.text, - entry.level, - entry.lineIndex, - entry.parentId, - entry.hasChildren, - entry.isLastChild, - ], - ], - ]); - oracleHits ??= hitDigest; - oracleFingerprints ??= fingerprintDigest; - oracleToc ??= tocDigest; - oracleCache ??= cacheDigest; - expect(hitDigest, oracleHits); - expect(fingerprintDigest, oracleFingerprints); - expect(tocDigest, oracleToc); - expect(cacheDigest, oracleCache); - rows.add({ - 'pass': pass, - 'warmup': pass == 0, - 'primedImportCache': primed, - 'elapsedUs': clock.elapsedMicroseconds, - 'prepareUs': prepareUs, - 'indexUs': indexUs, - 'cacheCloseUs': cacheCloseUs, - 'paragraphsPerBook': paragraphs, - 'sourceBytes': [for (final bytes in corpus) bytes.length], - 'books': result.indexedBooks, - 'documentsMatched': hits.length, - 'hitsPerBook': perBook, - 'hitContentSha256': hitDigest, - 'textFingerprintSha256': fingerprintDigest, - 'textFingerprints': { - for (final stamp in stamps) stamp.first: stamp.last, - }, - 'tocSha256': tocDigest, - 'persistedCacheTextSha256': cacheDigest, - 'persistedCacheEntries': cachedTexts.length, - 'rssBytesAfter': ProcessInfo.currentRss, - 'peakRssBytesProcess': ProcessInfo.maxRss, - }); - } finally { - await engine.closeIndexWriter(); - engine.dispose(); - await CacheDatabaseHolder.instance.close(); - } - } - } - await File(output!).writeAsString( - jsonEncode({ - 'schemaVersion': 2, - 'comparison': 'within-candidate cache priming policy ablation; not immutable git baseline', - 'policy': 'scope primes metadata preparation only; indexing retains its ordinary asynchronous cache persistence in both policies', - 'buildMode': 'flutter-test-debug/native-build-hook', - 'scope': 'metadata preparation, repository indexing and cache durability; excludes fixture creation, discovery, UI and verification', - 'cacheState': - 'fresh files/index/cache per observation; OS cache uncontrolled', - 'economy': false, - 'paragraphsPerBook': paragraphs, - 'bookCount': bookCount, - 'sourceBytes': [for (final bytes in corpus) bytes.length], - 'warmupPasses': 1, - 'measuredPasses': 5, - 'order': 'alternating paired policy order, balanced across warmup and measured passes', - 'os': Platform.operatingSystem, - 'dartVersion': Platform.version, - 'processors': Platform.numberOfProcessors, - 'manifest': manifest, - 'loadedEnginePath': enginePath.absolute.path, - 'loadedEngineSha256': engineDigest, - 'rows': rows, - }), - ); - }, - skip: output == null - ? 'Set OTZARIA_IMPORT_INDEXING_PROBE_OUT to measure' - : false, - timeout: const Timeout(Duration(minutes: 20)), - ); -} From 11148b8be3dfb20ca124ebcc8c8d940a1f4b3740 Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 00:48:01 +0200 Subject: [PATCH 05/11] =?UTF-8?q?QA:=20=D7=9E=D7=AA=D7=90=D7=9D=20profile?= =?UTF-8?q?=20=D7=AA=D7=A7=D7=99=D7=9F=20=D7=95=D7=94=D7=95=D7=9B=D7=97?= =?UTF-8?q?=D7=AA=20=D7=97=D7=96=D7=A8=D7=AA=20=D7=90=D7=A6=D7=95=D7=95?= =?UTF-8?q?=D7=AA=20=D7=9E=D7=95=D7=9C=20=D7=94=D7=91=D7=A1=D7=99=D7=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexing_native_probe_test.dart | 44 +- .../library_batch_indexing_test.dart | 97 +++- .../indexing_native_probe_test.dart | 438 +++++++++--------- tool/perf_probe/run_indexing_pair.py | 4 +- .../verify_indexing_recovery_regression.py | 29 +- 5 files changed, 350 insertions(+), 262 deletions(-) diff --git a/integration_test/indexing_native_probe_test.dart b/integration_test/indexing_native_probe_test.dart index 195c4343d5..ebbe5fe61b 100644 --- a/integration_test/indexing_native_probe_test.dart +++ b/integration_test/indexing_native_probe_test.dart @@ -2,47 +2,34 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; -import 'package:window_manager/window_manager.dart'; import '../test/tool/perf_probe/indexing_native_probe_test.dart' as native_probe; +import 'support/webview_probe_window.dart'; + void main() { final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); binding.framePolicy = LiveTestWidgetsFlutterBindingFramePolicy.fullyLive; - final root = Platform.environment['OTZARIA_INDEXING_PROBE_ROOT']; - if (root != null) Directory.current = root; - final output = Platform.environment['OTZARIA_INDEXING_PROBE_OUT']; - final existedAtStart = output != null && File(output).existsSync(); - runApp(const SizedBox.shrink()); - setUpAll(() async { - const timeout = Duration(seconds: 10); - await windowManager.ensureInitialized().timeout(timeout); - await windowManager.setSize(const Size(640, 480)).timeout(timeout); - await windowManager.show().timeout(timeout); - await const MethodChannel('otzaria/splash') - .invokeMethod('close') - .timeout(timeout); - expect(await windowManager.isVisible(), isTrue); - }); - native_probe.main(); - - // בדיקת test רגילה אינה נרשמת ב-results של מנהל בדיקות האינטגרציה. testWidgets('native indexing report completed and verified', (tester) async { + final root = Platform.environment['OTZARIA_INDEXING_PROBE_ROOT']; + if (root != null) { + Directory.current = root; + } + final output = Platform.environment['OTZARIA_INDEXING_PROBE_OUT']; expect(output, isNotNull, reason: 'Set OTZARIA_INDEXING_PROBE_OUT'); - expect(existedAtStart, isFalse, reason: 'Use a fresh output path'); final file = File(output!); - expect( - await file.exists(), - isTrue, - reason: 'Native probe did not complete', + expect(await file.exists(), isFalse, reason: 'Use a fresh output path'); + await tester.pumpWidget(const SizedBox.shrink()); + final window = await prepareWebViewProbeWindow( + platform: Platform.operatingSystem, + pumpFrame: () => tester.pump(const Duration(milliseconds: 16)), ); - final report = - jsonDecode(await file.readAsString()) as Map; + expect(window['ready'], isTrue); + final report = await native_probe.runNativeIndexingMeasurement(file.path); expect(report['schemaVersion'], 2); final pdfPageCount = report['pdfPageCount'] as int; expect(pdfPageCount, greaterThan(0)); @@ -82,10 +69,11 @@ void main() { : kReleaseMode ? 'integration-test-release-aot/native-build-hook' : 'integration-test-debug/native-build-hook'; + report['window'] = window; report['executionHarness'] = 'minimal native window; no UI responsiveness measurement'; await file.writeAsString(jsonEncode(report)); binding.reportData = report; await tester.pumpWidget(const SizedBox.shrink()); - }); + }, timeout: const Timeout(Duration(minutes: 15))); } diff --git a/test/indexing/repository/library_batch_indexing_test.dart b/test/indexing/repository/library_batch_indexing_test.dart index b318ae5181..d622c5eb20 100644 --- a/test/indexing/repository/library_batch_indexing_test.dart +++ b/test/indexing/repository/library_batch_indexing_test.dart @@ -8,9 +8,11 @@ import 'package:otzaria/attached_libraries/models/attached_library.dart'; import 'package:otzaria/attached_libraries/repository/attached_library_registry.dart'; import 'package:otzaria/data/data_providers/tantivy_data_provider.dart'; import 'package:otzaria/indexing/models/index_commit_policy.dart'; +import 'package:otzaria/indexing/models/indexing_run_diagnostics.dart'; import 'package:otzaria/indexing/models/indexing_resource_policy.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; import 'package:otzaria/indexing/repository/indexing_repository.dart'; +import 'package:otzaria/indexing/utils/indexing_crash_canary.dart'; import 'package:otzaria/indexing/utils/pending_reindex_store.dart'; import 'package:otzaria/library/models/library.dart'; import 'package:otzaria/models/book_source.dart'; @@ -325,8 +327,11 @@ void main() { final previous = AttachedLibraryRegistry.instance; AttachedLibraryRegistry.instance = registry; addTearDown(() => AttachedLibraryRegistry.instance = previous); - AttachedLibraryRegistry.configureEngineSource = - ({required slug, dbPath, required immutable}) async {}; + AttachedLibraryRegistry.configureEngineSource = ({ + required slug, + dbPath, + required immutable, + }) async {}; addTearDown( () => AttachedLibraryRegistry.configureEngineSource = configureAttachedLineSource, @@ -650,6 +655,85 @@ void main() { ]); }); + test( + 'אחרי טיפול בספר החשוד חוזרים לאצווה גדולה ושומרים את כל המסמכים', + () async { + final dir = await Directory.systemTemp.createTemp( + 'batch_recovery_resume', + ); + addTearDown(() => dir.delete(recursive: true)); + provider.activeIndexPath = p.join(dir.path, 'index'); + final canaryFile = File('${provider.activeIndexPath}.in_flight.json'); + await canaryFile.writeAsString(jsonEncode({'id:2': 1})); + final books = officialBooks(20); + + final result = await repository.indexAllBooks( + libraryOf(books), + onProgress: (_, _) {}, + ); + + expect(engine.batches.length, lessThan(20)); + expect(engine.batches[0], ['id:1']); + expect(engine.batches[1], ['id:2']); + expect(engine.batches.skip(2).any((batch) => batch.length > 1), isTrue); + expect(engine.batches.skip(2).expand((batch) => batch), [ + for (var id = 3; id <= 20; id++) 'id:$id', + ]); + final keys = {for (var id = 1; id <= 20; id++) 'id:$id'}; + expect(engine.batches.expand((batch) => batch), hasLength(20)); + expect(provider.indexedFilePaths, keys); + expect(engine.committedFilePaths, keys); + expect(engine.pending, isEmpty); + expect(engine.bytesFilePaths, isEmpty); + expect(result.isClean, isTrue); + expect(result.processedBooks, 20); + expect(result.indexedBooks, 20); + expect(result.diagnostics!.recoveryStarted, isTrue); + expect(result.diagnostics!.counters[IndexingCounter.documents], 60); + expect(jsonDecode(await canaryFile.readAsString()), isEmpty); + }, + ); + + test('ספר בריא בטיסה אינו מצמצם אצוות של ספרי הספרייה', () async { + final dir = await Directory.systemTemp.createTemp( + 'batch_healthy_in_flight', + ); + addTearDown(() => dir.delete(recursive: true)); + provider.activeIndexPath = p.join(dir.path, 'index'); + final books = officialBooks(20); + IndexingCrashCanary? activeCanary; + const healthyKey = 'healthy-pdf-in-flight'; + + final result = await repository.indexAllBooks( + libraryOf(books), + onProgress: (processed, _) { + if (processed == 1 && activeCanary == null) { + activeCanary = IndexingCrashCanary.current!; + // מדמה רישום של PDF בריא שהחל בחילוץ מוקדם ועדיין בטיסה; + // לא מפעיל PDFium ואינו מסמן חשוד מריצה קודמת. + expect(activeCanary!.begin(healthyKey), isTrue); + } + }, + ); + expect(activeCanary, isNotNull); + activeCanary!.end(healthyKey); + await activeCanary!.flush(); + + expect(engine.batches.first.length, greaterThan(1)); + expect(engine.batches, hasLength(2)); + final keys = {for (var id = 1; id <= 20; id++) 'id:$id'}; + expect(engine.batches.expand((batch) => batch), hasLength(20)); + expect(provider.indexedFilePaths, keys); + expect(engine.committedFilePaths, keys); + expect(engine.pending, isEmpty); + expect(engine.bytesFilePaths, isEmpty); + expect(result.isClean, isTrue); + expect(result.processedBooks, 20); + expect(result.indexedBooks, 20); + expect(result.diagnostics!.recoveryStarted, isFalse); + expect(result.diagnostics!.counters[IndexingCounter.documents], 60); + }); + test('ספרי האצווה רשומים בקובץ הקריסות לפני המנוע (issue #3330)', () async { final dir = await Directory.systemTemp.createTemp('batch_canary'); addTearDown(() => dir.delete(recursive: true)); @@ -711,9 +795,12 @@ void main() { }); test('ספר שהמנוע לא מצא נבדק דרך Dart כמו קודם', () async { - IndexingRepository.libraryFingerprint = - ({required source, required bookId, dbTitle, attachedSlug}) async => - null; + IndexingRepository.libraryFingerprint = ({ + required source, + required bookId, + dbTitle, + attachedSlug, + }) async => null; final book = TextBook(id: 7, title: 'ז', categoryId: 1); await repository.textBookContentMatchesIndex(book, BigInt.from(1)); diff --git a/test/tool/perf_probe/indexing_native_probe_test.dart b/test/tool/perf_probe/indexing_native_probe_test.dart index bdb527fede..7cdb0f5dad 100644 --- a/test/tool/perf_probe/indexing_native_probe_test.dart +++ b/test/tool/perf_probe/indexing_native_probe_test.dart @@ -31,223 +31,7 @@ void main() { test( 'isolated native indexing measurement', () async { - final pdfPageCount = int.parse( - Platform.environment['OTZARIA_INDEXING_PROBE_PDF_PAGES'] ?? '4', - ); - expect(pdfPageCount, greaterThan(0)); - expect(await tryInitSearchEngine(), true, reason: searchEngineSkipReason); - final loadedEngine = File(searchEngineLoadedLibraryPath!); - final loadedEngineDigest = sha256 - .convert(await loadedEngine.readAsBytes()) - .toString(); - final root = await Directory.systemTemp.createTemp('indexing-probe-'); - final oldModule = Pdfrx.pdfiumModulePath; - final module = Platform.isWindows - ? 'pdfium.dll' - : Platform.isMacOS - ? 'libpdfium_dart.dylib' - : 'libpdfium.so'; - Pdfrx.pdfiumModulePath = File( - 'build/native_assets/${Platform.operatingSystem}/$module', - ).absolute.path; - await pdfrxInitialize(tmpPath: root.path); - AppPaths.debugOverrideDataRootPath(root.path); - addTearDown(() async { - await CacheDatabaseHolder.instance.close(); - AppPaths.debugOverrideDataRootPath(null); - Pdfrx.pdfiumModulePath = oldModule; - await root.delete(recursive: true); - }); - final rows = >[]; - final manifest = {}; - for (final economy in [false, true]) { - for (final kind in ['txt', 'docx', 'pdf', 'pdf-recovery']) { - final directory = await Directory('${root.path}/$kind-$economy') - .create(); - await Settings.init(cacheProvider: MemoryCacheProvider()); - await Settings.setValue( - SettingsRepository.keyDatabasesPath, - directory.path, - ); - await Settings.setValue( - SettingsRepository.keyLibraryPath, - directory.path, - ); - final index = await Directory('${directory.path}/index').create(); - final engine = await SearchEngine.newInstance(path: index.path); - final provider = TantivyDataProvider.forTesting(Future.value(engine)) - ..activeIndexPath = index.path - ..isInitialized.value = true; - TantivyDataProvider.instance = provider; - final repository = IndexingRepository( - provider, - indexPdfBooks: () => true, - indexUpdateMode: () => IndexUpdateMode.all, - ); - await repository.setEconomyIndexing(economy); - final pdf = kind.startsWith('pdf'); - final extension = pdf ? 'pdf' : kind; - final books = []; - final texts = List.generate( - 1000, - (i) => - 'benchmarktoken שורה מספר $i עם תוכן ארוך מספיק לאינדוקס ומילים נוספות לבדיקת שלמות התוצאות', - ); - final archive = Archive(); - final xml = utf8.encode( - '${texts.map((line) => '$line').join()}', - ); - archive.addFile( - ArchiveFile('word/document.xml', xml.length, xml)..lastModTime = 0, - ); - final bytes = pdf - ? createInstalledPdfFixture(pageCount: pdfPageCount) - : kind == 'docx' - ? ZipEncoder().encode(archive) - : utf8.encode(texts.join('\n')); - manifest[kind] = sha256.convert(bytes).toString(); - for (var i = 0; i < 8; i++) { - final file = await File('${directory.path}/book$i.$extension') - .writeAsBytes(bytes); - books.add( - pdf - ? PdfBook( - title: 'book$i', - path: file.path, - source: BookSource.user, - ) - : kind == 'txt' - ? _FileTextBook(title: 'book$i', path: file.path) - : TextBook( - title: 'book$i', - filePath: file.path, - fileType: kind, - source: BookSource.user, - ), - ); - } - if (kind == 'pdf-recovery') { - await File('${index.path}.in_flight.json').writeAsString( - jsonEncode({ - books.first.filePath ?? (books.first as PdfBook).path: 1, - }), - ); - } - final library = Library(categories: [])..books.addAll(books); - final watch = Stopwatch()..start(); - if (!pdf) { - for (final book in books) { - final file = File(book.filePath!); - await PreparedExternalBook.prepare( - file.path, - await file.stat(), - kind == 'docx' ? DocumentFormat.docx : DocumentFormat.txt, - ); - } - } - final result = await repository.runIndexing( - library, - books: books, - onProgress: (_, _) {}, - ); - watch.stop(); - expect(result.isClean, true, reason: '${result.failures}'); - expect(result.indexedBooks, 8); - final segmentCount = await engine.getSegmentCount(); - expect(segmentCount, greaterThan(0)); - final expected = pdf ? 8 * pdfPageCount : 8000; - final hits = await engine.searchExact( - query: pdf ? installedPdfQuery : 'benchmarktoken', - facets: const [], - limit: expected, - offset: 0, - order: ResultsOrder.catalogue, - matchNikud: false, - matchTaamim: false, - ); - expect(hits, hasLength(expected)); - final keysToTitles = { - for (final book in books) - BookIdentity.indexedFilePath(book): book.title, - }; - final fingerprints = await engine.getBookTextFingerprints(); - expect(fingerprints.keys.toSet(), keysToTitles.keys.toSet()); - final stamps = >[]; - for (final entry in keysToTitles.entries) { - final hash = fingerprints[entry.key]!; - expect(hash, greaterThan(BigInt.zero), reason: entry.value); - stamps.add([entry.value, hash.toString()]); - } - stamps.sort((a, b) => a.first.compareTo(b.first)); - final hitsPerBook = {}; - final canonicalHits = []; - for (final hit in hits) { - expect(keysToTitles[hit.filePath], hit.title); - expect(hit.textStatus, TextStatus.ok); - expect(hit.text, isNotEmpty); - expect(hit.isPdf, pdf); - hitsPerBook.update( - hit.title, - (count) => count + 1, - ifAbsent: () => 1, - ); - canonicalHits.add( - jsonEncode([ - hit.title, - hit.reference, - hit.text, - hit.isPdf, - hit.continuesToNextLine, - ]), - ); - } - expect(hitsPerBook.keys.toSet(), keysToTitles.values.toSet()); - expect(hitsPerBook.values, everyElement(expected ~/ 8)); - canonicalHits.sort(); - rows.add({ - 'case': kind, - 'economy': economy, - 'elapsedUs': watch.elapsedMicroseconds, - 'documentsMatched': hits.length, - 'books': result.indexedBooks, - 'segmentCount': segmentCount, - 'textFingerprints': { - for (final stamp in stamps) stamp.first: stamp.last, - }, - 'textFingerprintSha256': sha256 - .convert(utf8.encode(jsonEncode(stamps))) - .toString(), - 'hitsPerBook': hitsPerBook, - 'hitContentSha256': sha256 - .convert(utf8.encode(jsonEncode(canonicalHits))) - .toString(), - 'rssBytesAfter': ProcessInfo.currentRss, - 'peakRssBytesProcess': ProcessInfo.maxRss, - }); - await engine.closeIndexWriter(); - engine.dispose(); - await CacheDatabaseHolder.instance.close(); - } - } - await File(output!).writeAsString( - jsonEncode({ - 'schemaVersion': 2, - 'pdfPageCount': pdfPageCount, - 'buildMode': 'flutter-test-debug/native-build-hook', - 'os': Platform.operatingSystem, - 'dartVersion': Platform.version, - 'processors': Platform.numberOfProcessors, - 'cacheState': 'fresh application index/cache; OS cache uncontrolled', - 'scope': 'metadata preparation and repository indexing, not folder scanning or UI responsiveness', - 'manifest': manifest, - 'loadedEnginePath': loadedEngine.absolute.path, - 'loadedEngineSha256': loadedEngineDigest, - 'pdfiumSha256': sha256 - .convert(await File(Pdfrx.pdfiumModulePath!).readAsBytes()) - .toString(), - 'rows': rows, - }), - ); + await runNativeIndexingMeasurement(output!); }, skip: output == null ? 'Set OTZARIA_INDEXING_PROBE_OUT to measure indexing' @@ -256,6 +40,226 @@ void main() { ); } +/// מריץ מדידה ואימות תוכן מתוך גוף בדיקה פעילה. +Future> runNativeIndexingMeasurement(String output) async { + final pdfPageCount = int.parse( + Platform.environment['OTZARIA_INDEXING_PROBE_PDF_PAGES'] ?? '4', + ); + expect(pdfPageCount, greaterThan(0)); + expect(await tryInitSearchEngine(), true, reason: searchEngineSkipReason); + final loadedEngine = File(searchEngineLoadedLibraryPath!); + final loadedEngineDigest = sha256 + .convert(await loadedEngine.readAsBytes()) + .toString(); + final root = await Directory.systemTemp.createTemp('indexing-probe-'); + final oldModule = Pdfrx.pdfiumModulePath; + final module = Platform.isWindows + ? 'pdfium.dll' + : Platform.isMacOS + ? 'libpdfium_dart.dylib' + : 'libpdfium.so'; + Pdfrx.pdfiumModulePath = File( + 'build/native_assets/${Platform.operatingSystem}/$module', + ).absolute.path; + await pdfrxInitialize(tmpPath: root.path); + AppPaths.debugOverrideDataRootPath(root.path); + addTearDown(() async { + await CacheDatabaseHolder.instance.close(); + AppPaths.debugOverrideDataRootPath(null); + Pdfrx.pdfiumModulePath = oldModule; + await root.delete(recursive: true); + }); + final rows = >[]; + final manifest = {}; + for (final economy in [false, true]) { + for (final kind in ['txt', 'docx', 'pdf', 'pdf-recovery']) { + final directory = await Directory('${root.path}/$kind-$economy').create(); + await Settings.init(cacheProvider: MemoryCacheProvider()); + await Settings.setValue( + SettingsRepository.keyDatabasesPath, + directory.path, + ); + await Settings.setValue( + SettingsRepository.keyLibraryPath, + directory.path, + ); + final index = await Directory('${directory.path}/index').create(); + final engine = await SearchEngine.newInstance(path: index.path); + final provider = TantivyDataProvider.forTesting(Future.value(engine)) + ..activeIndexPath = index.path + ..isInitialized.value = true; + TantivyDataProvider.instance = provider; + final repository = IndexingRepository( + provider, + indexPdfBooks: () => true, + indexUpdateMode: () => IndexUpdateMode.all, + ); + await repository.setEconomyIndexing(economy); + final pdf = kind.startsWith('pdf'); + final extension = pdf ? 'pdf' : kind; + final books = []; + final texts = List.generate( + 1000, + (i) => + 'benchmarktoken שורה מספר $i עם תוכן ארוך מספיק לאינדוקס ומילים נוספות לבדיקת שלמות התוצאות', + ); + final archive = Archive(); + final xml = utf8.encode( + '${texts.map((line) => '$line').join()}', + ); + archive.addFile( + ArchiveFile('word/document.xml', xml.length, xml)..lastModTime = 0, + ); + final bytes = pdf + ? createInstalledPdfFixture(pageCount: pdfPageCount) + : kind == 'docx' + ? ZipEncoder().encode(archive) + : utf8.encode(texts.join('\n')); + manifest[kind] = sha256.convert(bytes).toString(); + for (var i = 0; i < 8; i++) { + final file = await File('${directory.path}/book$i.$extension') + .writeAsBytes(bytes); + books.add( + pdf + ? PdfBook( + title: 'book$i', + path: file.path, + source: BookSource.user, + ) + : kind == 'txt' + ? _FileTextBook(title: 'book$i', path: file.path) + : TextBook( + title: 'book$i', + filePath: file.path, + fileType: kind, + source: BookSource.user, + ), + ); + } + if (kind == 'pdf-recovery') { + await File('${index.path}.in_flight.json').writeAsString( + jsonEncode({ + books.first.filePath ?? (books.first as PdfBook).path: 1, + }), + ); + } + final library = Library(categories: [])..books.addAll(books); + final watch = Stopwatch()..start(); + if (!pdf) { + for (final book in books) { + final file = File(book.filePath!); + await PreparedExternalBook.prepare( + file.path, + await file.stat(), + kind == 'docx' ? DocumentFormat.docx : DocumentFormat.txt, + ); + } + } + final result = await repository.runIndexing( + library, + books: books, + onProgress: (_, _) {}, + ); + watch.stop(); + expect(result.isClean, true, reason: '${result.failures}'); + expect(result.indexedBooks, 8); + final segmentCount = await engine.getSegmentCount(); + expect(segmentCount, greaterThan(0)); + final expected = pdf ? 8 * pdfPageCount : 8000; + final hits = await engine.searchExact( + query: pdf ? installedPdfQuery : 'benchmarktoken', + facets: const [], + limit: expected, + offset: 0, + order: ResultsOrder.catalogue, + matchNikud: false, + matchTaamim: false, + ); + expect(hits, hasLength(expected)); + final keysToTitles = { + for (final book in books) + BookIdentity.indexedFilePath(book): book.title, + }; + final fingerprints = await engine.getBookTextFingerprints(); + expect(fingerprints.keys.toSet(), keysToTitles.keys.toSet()); + final stamps = >[]; + for (final entry in keysToTitles.entries) { + final hash = fingerprints[entry.key]!; + expect(hash, greaterThan(BigInt.zero), reason: entry.value); + stamps.add([entry.value, hash.toString()]); + } + stamps.sort((a, b) => a.first.compareTo(b.first)); + final hitsPerBook = {}; + final canonicalHits = []; + for (final hit in hits) { + expect(keysToTitles[hit.filePath], hit.title); + expect(hit.textStatus, TextStatus.ok); + expect(hit.text, isNotEmpty); + expect(hit.isPdf, pdf); + hitsPerBook.update( + hit.title, + (count) => count + 1, + ifAbsent: () => 1, + ); + canonicalHits.add( + jsonEncode([ + hit.title, + hit.reference, + hit.text, + hit.isPdf, + hit.continuesToNextLine, + ]), + ); + } + expect(hitsPerBook.keys.toSet(), keysToTitles.values.toSet()); + expect(hitsPerBook.values, everyElement(expected ~/ 8)); + canonicalHits.sort(); + rows.add({ + 'case': kind, + 'economy': economy, + 'elapsedUs': watch.elapsedMicroseconds, + 'documentsMatched': hits.length, + 'books': result.indexedBooks, + 'segmentCount': segmentCount, + 'textFingerprints': { + for (final stamp in stamps) stamp.first: stamp.last, + }, + 'textFingerprintSha256': sha256 + .convert(utf8.encode(jsonEncode(stamps))) + .toString(), + 'hitsPerBook': hitsPerBook, + 'hitContentSha256': sha256 + .convert(utf8.encode(jsonEncode(canonicalHits))) + .toString(), + 'rssBytesAfter': ProcessInfo.currentRss, + 'peakRssBytesProcess': ProcessInfo.maxRss, + }); + await engine.closeIndexWriter(); + engine.dispose(); + await CacheDatabaseHolder.instance.close(); + } + } + final report = { + 'schemaVersion': 2, + 'pdfPageCount': pdfPageCount, + 'buildMode': 'flutter-test-debug/native-build-hook', + 'os': Platform.operatingSystem, + 'dartVersion': Platform.version, + 'processors': Platform.numberOfProcessors, + 'cacheState': 'fresh application index/cache; OS cache uncontrolled', + 'scope': 'metadata preparation and repository indexing, not folder scanning or UI responsiveness', + 'manifest': manifest, + 'loadedEnginePath': loadedEngine.absolute.path, + 'loadedEngineSha256': loadedEngineDigest, + 'pdfiumSha256': sha256 + .convert(await File(Pdfrx.pdfiumModulePath!).readAsBytes()) + .toString(), + 'rows': rows, + }; + await File(output).writeAsString(jsonEncode(report)); + return report; +} + /// הקטלוג אינו חלק מהמדידה; הקובץ נקרא דרך מפענח הטקסט של האפליקציה. class _FileTextBook extends TextBook { _FileTextBook({required super.title, required String path}) diff --git a/tool/perf_probe/run_indexing_pair.py b/tool/perf_probe/run_indexing_pair.py index b160f29e09..880c6dce09 100644 --- a/tool/perf_probe/run_indexing_pair.py +++ b/tool/perf_probe/run_indexing_pair.py @@ -15,6 +15,7 @@ HARNESS = "test/tool/perf_probe/indexing_native_probe_test.dart" PROFILE_TARGET = "integration_test/indexing_native_probe_test.dart" PROFILE_DRIVER = "test_driver/indexing_native_probe.dart" +PROFILE_WINDOW_SUPPORT = "integration_test/support/webview_probe_window.dart" SUPPORT = [HARNESS, "integration_test/support/installed_plugin_pdf_fixture.dart", "test/support/search_engine_test_init.dart", "test/test_helpers/memory_cache_provider.dart"] @@ -153,7 +154,8 @@ def main(): checkout = scratch / role command(["git", "worktree", "add", "--detach", str(checkout), commit], root) snapshots[role] = checkout - support = SUPPORT + ([PROFILE_TARGET, PROFILE_DRIVER] if args.mode == 'profile' else []) + support = SUPPORT + ([PROFILE_TARGET, PROFILE_DRIVER, PROFILE_WINDOW_SUPPORT] + if args.mode == 'profile' else []) for relative in support: target = checkout / relative target.parent.mkdir(parents=True, exist_ok=True) diff --git a/tool/perf_probe/verify_indexing_recovery_regression.py b/tool/perf_probe/verify_indexing_recovery_regression.py index e6912f6916..d19dee6159 100644 --- a/tool/perf_probe/verify_indexing_recovery_regression.py +++ b/tool/perf_probe/verify_indexing_recovery_regression.py @@ -21,23 +21,30 @@ def main(): source = Path("lib/indexing/utils/indexing_crash_canary.dart") test = Path("test/indexing/utils/indexing_crash_canary_test.dart") name = re.search(r"test\('([^']+)'", test.read_text(encoding="utf-8")).group(1) + cases = [ + ('recovery', test, name, ('Expected: false', 'Actual: ')), + ('healthy-batching', Path('test/indexing/repository/library_batch_indexing_test.dart'), + 'ספר בריא בטיסה אינו מצמצם אצוות של ספרי הספרייה', + ('Expected: a value greater than <1>', 'Actual: <1>')), + ] baseline = subprocess.check_output(["git", "show", f"{args.baseline}:{source.as_posix()}"]) candidate = source.read_bytes() args.output.mkdir(parents=True, exist_ok=True) try: for label, content in (("baseline", baseline), ("candidate", candidate)): source.write_bytes(content) - result = subprocess.run( - [flutter, "test", "--no-pub", str(test), "--plain-name", name], - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - text=True, encoding="utf-8", errors="replace", check=False, - ) - (args.output / f"recovery-{label}.log").write_text(result.stdout, encoding="utf-8") - if label == "baseline": - if result.returncode != 1 or "Expected: false" not in result.stdout or "Actual: " not in result.stdout: - raise RuntimeError("Baseline did not fail at the intended recovery assertion") - elif result.returncode: - raise RuntimeError("Candidate failed the recovery regression") + for case, target, title, failure in cases: + result = subprocess.run( + [flutter, "test", "--no-pub", str(target), "--plain-name", title], + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + text=True, encoding="utf-8", errors="replace", check=False, + ) + (args.output / f"{case}-{label}.log").write_text(result.stdout, encoding="utf-8") + if label == "baseline": + if result.returncode != 1 or not all(text in result.stdout for text in failure): + raise RuntimeError(f"Baseline did not fail at the intended {case} assertion") + elif result.returncode: + raise RuntimeError(f"Candidate failed the {case} regression") finally: source.write_bytes(candidate) From 742e63d77291809edd42643f508f4af367a860de Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 01:32:07 +0200 Subject: [PATCH 06/11] =?UTF-8?q?=D7=9E=D7=93=D7=99=D7=93=D7=94:=20=D7=91?= =?UTF-8?q?=D7=99=D7=A0=D7=90=D7=A8=D7=99=20AOT=20=D7=A7=D7=91=D7=95=D7=A2?= =?UTF-8?q?=20=D7=95=D7=94=D7=A9=D7=95=D7=95=D7=90=D7=AA=20=D7=96=D7=95?= =?UTF-8?q?=D7=92=D7=95=D7=AA=20=D7=9C=D7=A4=D7=99=20=D7=97=D7=96=D7=A8?= =?UTF-8?q?=D7=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/perf_probe/run_indexing_pair.py | 109 +++++++++++++++++++++++--- tool/perf_probe/test_indexing_pair.py | 102 +++++++++++++++++++++++- 2 files changed, 199 insertions(+), 12 deletions(-) diff --git a/tool/perf_probe/run_indexing_pair.py b/tool/perf_probe/run_indexing_pair.py index 880c6dce09..2b7f4be462 100644 --- a/tool/perf_probe/run_indexing_pair.py +++ b/tool/perf_probe/run_indexing_pair.py @@ -24,10 +24,55 @@ BOOK_TITLES = {f"book{index}" for index in range(8)} -def measurement_command(flutter, mode): +def profile_build_command(flutter): + return [flutter, 'build', 'windows', '--profile', '--no-pub', + '--target=' + PROFILE_TARGET] + + +def profile_artifact_hashes(executable): + executable = Path(executable) + if executable.suffix.lower() != '.exe' or not executable.is_file(): + raise ValueError('A built Windows profile executable is required') + if not (executable.parent / 'portable.marker').is_file(): + raise ValueError('Profile bundle must have its own portable.marker') + files = {'otzaria.exe': executable, + 'data/app.so': executable.parent / 'data/app.so', + 'flutter_windows.dll': executable.parent / 'flutter_windows.dll'} + for relative, path in files.items(): + if not path.is_file(): + raise ValueError(f'Missing profile application artifact: {relative}') + return {relative: hashlib.sha256(path.read_bytes()).hexdigest() + for relative, path in files.items()} + + +def prepare_profile_application(flutter, checkout, log): + executable = checkout / 'build/windows/x64/runner/Profile/otzaria.exe' + executable.parent.mkdir(parents=True, exist_ok=True) + command(profile_build_command(flutter), checkout, log) + (executable.parent / 'portable.marker').touch() + return executable, profile_artifact_hashes(executable) + + +def verify_profile_artifacts(executable, expected): + if profile_artifact_hashes(executable) != expected: + raise ValueError('Profile application artifacts changed after their build') + + +def validate_profile_pair(artifacts): + if artifacts['baseline']['flutter_windows.dll'] != artifacts['candidate']['flutter_windows.dll']: + raise ValueError('Profile builds use different Flutter engine binaries') + + +def measurement_command(flutter, mode, application_binary=None): if mode == 'profile': + if application_binary is None: + raise ValueError('Profile measurements require a prebuilt application') + application_binary = Path(application_binary) + if application_binary.suffix.lower() != '.exe' or not application_binary.is_file(): + raise ValueError('Profile application executable is missing') return [flutter, 'drive', '--profile', '-d', 'windows', '--no-pub', - '--target=' + PROFILE_TARGET, '--driver=' + PROFILE_DRIVER] + '--target=' + PROFILE_TARGET, '--driver=' + PROFILE_DRIVER, + '--use-application-binary=' + str(application_binary)] if mode != 'debug': raise ValueError('Unsupported measurement mode') return [flutter, 'test', '--no-pub', HARNESS, '--concurrency=1'] @@ -95,12 +140,23 @@ def compare(samples): results = [] for kind, economy in sorted(CASES): by_role = {} + iterations_by_role = {} fingerprints = set() hit_contents = set() for role in ("baseline", "candidate"): - rows = [row for sample in measured if sample["role"] == role - for row in sample["report"]["rows"] - if row["case"] == kind and row["economy"] == economy] + iterations = {} + for sample in measured: + if sample['role'] != role: + continue + iteration = sample.get('iteration') + if type(iteration) is not int or iteration < 0: + raise ValueError('Measured samples require a non-negative integer iteration') + if iteration in iterations: + raise ValueError(f'Duplicate measured iteration: {role}, {iteration}') + iterations[iteration] = next(row for row in sample['report']['rows'] + if row['case'] == kind and row['economy'] == economy) + iterations_by_role[role] = iterations + rows = list(iterations.values()) if len(rows) < 5: raise ValueError("At least five measured repetitions per source required") fingerprints.update(row["textFingerprintSha256"] for row in rows) @@ -116,8 +172,23 @@ def compare(samples): raise ValueError(f"Indexed contents changed: {kind}, economy={economy}") if len(hit_contents) != 1: raise ValueError(f"Result contents changed: {kind}, economy={economy}") + if iterations_by_role['baseline'].keys() != iterations_by_role['candidate'].keys(): + raise ValueError('Baseline and candidate measured iterations do not match') + pairs = [] + for iteration in sorted(iterations_by_role['baseline']): + baseline = iterations_by_role['baseline'][iteration]['elapsedUs'] + candidate = iterations_by_role['candidate'][iteration]['elapsedUs'] + pairs.append({'iteration': iteration, 'baselineMs': baseline / 1000, + 'candidateMs': candidate / 1000, + 'durationRatio': candidate / baseline, + 'durationDeltaMs': (candidate - baseline) / 1000}) results.append({"case": kind, "economy": economy, **by_role, - "durationRatio": by_role["candidate"]["medianMs"] / by_role["baseline"]["medianMs"]}) + "durationRatio": by_role["candidate"]["medianMs"] / by_role["baseline"]["medianMs"], + "durationRatioBasis": "ratio of group medians", + "paired": {'medianDurationRatio': statistics.median(pair['durationRatio'] for pair in pairs), + 'medianDurationDeltaMs': statistics.median(pair['durationDeltaMs'] for pair in pairs), + 'candidateSlowerPairs': sum(pair['durationDeltaMs'] > 0 for pair in pairs), + 'pairs': len(pairs), 'rows': pairs}}) return results @@ -147,6 +218,8 @@ def main(): snapshots = {} samples = [] shared_engine = None + profile_applications = {} + profile_artifacts = {} with tempfile.TemporaryDirectory(prefix="otz-idx-", dir=os.environ.get('RUNNER_TEMP')) as temporary: scratch = Path(temporary) try: @@ -165,6 +238,13 @@ def main(): for path in snapshots.values()] if locks[0] != locks[1]: raise ValueError("Lockfiles differ; this experiment isolates app-code changes") + if args.mode == 'profile': + for role, checkout in snapshots.items(): + executable, artifacts = prepare_profile_application( + flutter, checkout, output / f'{role}-profile-build.log') + profile_applications[role] = executable + profile_artifacts[role] = artifacts + validate_profile_pair(profile_artifacts) for iteration in range(args.warmups + args.repetitions): order = ("baseline", "candidate") if iteration % 2 == 0 else ("candidate", "baseline") for role in order: @@ -176,8 +256,15 @@ def main(): if shared_engine: env.update(OTZARIA_SEARCH_ENGINE_LIBRARY_PATH=shared_engine[0], OTZARIA_EXPECTED_SEARCH_ENGINE_SHA256=shared_engine[1]) - command(measurement_command(flutter, args.mode), - snapshots[role], output / f"{name}.log", env) + executable = profile_applications.get(role) + if executable is not None: + verify_profile_artifacts(executable, profile_artifacts[role]) + try: + command(measurement_command(flutter, args.mode, executable), + snapshots[role], output / f"{name}.log", env) + finally: + if executable is not None: + verify_profile_artifacts(executable, profile_artifacts[role]) report = json.loads(raw.read_text(encoding="utf-8")) validate(report) if report['pdfPageCount'] != args.pdf_pages: @@ -191,11 +278,15 @@ def main(): shutil.copy2(loaded, shared) shared_engine = (str(shared), report["loadedEngineSha256"]) samples.append({"role": role, "iteration": iteration, - "warmup": iteration < args.warmups, "report": report}) + "warmup": iteration < args.warmups, "report": report, + "applicationArtifactsSha256": profile_artifacts.get(role)}) (output / "raw.json").write_text(json.dumps(samples, ensure_ascii=False, indent=2), encoding="utf-8") result = {"baseline": args.baseline, "candidate": args.candidate, "measurementMode": args.mode, "pdfPageCount": args.pdf_pages, + "profileApplications": {role: {'executable': str(executable), + 'sha256': profile_artifacts[role]} + for role, executable in profile_applications.items()}, "lockSha256": locks[0], "harnessSha256": hashlib.sha256((root / HARNESS).read_bytes()).hexdigest(), "limitations": ["Flutter test debug harness; not release app performance" if args.mode == 'debug' diff --git a/tool/perf_probe/test_indexing_pair.py b/tool/perf_probe/test_indexing_pair.py index 23b6aeab48..e8def01364 100644 --- a/tool/perf_probe/test_indexing_pair.py +++ b/tool/perf_probe/test_indexing_pair.py @@ -1,9 +1,16 @@ import copy import hashlib import json +from pathlib import Path +import tempfile import unittest +from unittest.mock import patch -from tool.perf_probe.run_indexing_pair import CASES, compare, measurement_command, validate +from tool.perf_probe.run_indexing_pair import ( + CASES, compare, measurement_command, prepare_profile_application, + profile_artifact_hashes, profile_build_command, validate, validate_profile_pair, + verify_profile_artifacts, +) def fixture(pdf_pages=4): @@ -26,7 +33,15 @@ def fixture(pdf_pages=4): class IndexingPairTests(unittest.TestCase): def test_profile_uses_native_drive_and_debug_uses_test(self): - profile = measurement_command('flutter', 'profile') + with tempfile.TemporaryDirectory() as temporary: + executable = Path(temporary) / 'otzaria.exe' + executable.write_bytes(b'launcher') + profile = measurement_command('flutter', 'profile', executable) + self.assertIn('--use-application-binary=' + str(executable), profile) + with self.assertRaises(ValueError): + measurement_command('flutter', 'profile', executable.with_name('missing.exe')) + with self.assertRaises(ValueError): + measurement_command('flutter', 'profile', executable.parent) debug = measurement_command('flutter', 'debug') self.assertEqual(profile[:5], ['flutter', 'drive', '--profile', '-d', 'windows']) self.assertIn('--target=integration_test/indexing_native_probe_test.dart', profile) @@ -34,9 +49,58 @@ def test_profile_uses_native_drive_and_debug_uses_test(self): self.assertEqual(debug[:2], ['flutter', 'test']) with self.assertRaises(ValueError): measurement_command('flutter', 'release') + with self.assertRaises(ValueError): + measurement_command('flutter', 'profile') + self.assertEqual(profile_build_command('flutter'), [ + 'flutter', 'build', 'windows', '--profile', '--no-pub', + '--target=integration_test/indexing_native_probe_test.dart']) + + def test_profile_build_creates_portable_bundle_after_build_before_launch(self): + with tempfile.TemporaryDirectory() as temporary: + checkout = Path(temporary) + executable = checkout / 'build/windows/x64/runner/Profile/otzaria.exe' + + def build(args, cwd, log): + self.assertEqual(args, profile_build_command('flutter')) + self.assertEqual(cwd, checkout) + self.assertFalse((executable.parent / 'portable.marker').exists()) + executable.write_bytes(b'launcher') + (executable.parent / 'data').mkdir() + (executable.parent / 'data/app.so').write_bytes(b'aot') + (executable.parent / 'flutter_windows.dll').write_bytes(b'engine') + + with patch('tool.perf_probe.run_indexing_pair.command', side_effect=build) as mocked: + actual, hashes = prepare_profile_application('flutter', checkout, checkout / 'build.log') + mocked.assert_called_once() + self.assertEqual(actual, executable) + self.assertTrue((executable.parent / 'portable.marker').is_file()) + self.assertEqual(set(hashes), {'otzaria.exe', 'data/app.so', 'flutter_windows.dll'}) + verify_profile_artifacts(executable, hashes) + for name in hashes: + path = executable.parent / name + original = path.read_bytes() + path.write_bytes(original + b'changed') + with self.assertRaisesRegex(ValueError, 'artifacts changed'): + verify_profile_artifacts(executable, hashes) + path.unlink() + with self.assertRaises(ValueError): + profile_artifact_hashes(executable) + path.write_bytes(original) + (executable.parent / 'portable.marker').unlink() + with self.assertRaisesRegex(ValueError, 'portable.marker'): + profile_artifact_hashes(executable) + + def test_profile_pair_requires_identical_flutter_engine(self): + baseline = {'otzaria.exe': 'a', 'data/app.so': 'b', 'flutter_windows.dll': 'c'} + candidate = {'otzaria.exe': 'd', 'data/app.so': 'e', 'flutter_windows.dll': 'c'} + validate_profile_pair({'baseline': baseline, 'candidate': candidate}) + candidate['flutter_windows.dll'] = 'changed' + with self.assertRaisesRegex(ValueError, 'different Flutter engine'): + validate_profile_pair({'baseline': baseline, 'candidate': candidate}) def samples(self, pdf_pages=4): - return [{"role": role, "warmup": iteration == 0, "report": fixture(pdf_pages)} + return [{"role": role, "iteration": iteration, + "warmup": iteration == 0, "report": fixture(pdf_pages)} for iteration in range(6) for role in ("baseline", "candidate")] def test_pdf_page_count_requires_exact_per_book_results(self): @@ -65,6 +129,38 @@ def test_complete_comparison_excludes_warmup(self): self.assertEqual(len(result), 8) self.assertTrue(all(row["durationRatio"] == 1 for row in result)) self.assertTrue(all(row["baseline"]["samples"] == 5 for row in result)) + self.assertTrue(all(row['paired']['pairs'] == 5 for row in result)) + self.assertTrue(all(row['paired']['candidateSlowerPairs'] == 0 for row in result)) + + def test_pairing_by_iteration_preserves_majority_when_group_medians_reverse(self): + samples = self.samples() + durations = {'baseline': [10000, 20000, 30000, 100000, 200000], + 'candidate': [40000, 15000, 25000, 90000, 150000]} + for sample in samples: + if sample['warmup']: + continue + for row in sample['report']['rows']: + row['elapsedUs'] = durations[sample['role']][sample['iteration'] - 1] + for result in compare(list(reversed(samples))): + self.assertGreater(result['durationRatio'], 1) + paired = result['paired'] + self.assertAlmostEqual(paired['medianDurationRatio'], 5 / 6) + self.assertEqual(paired['medianDurationDeltaMs'], -5) + self.assertEqual(paired['candidateSlowerPairs'], 1) + self.assertEqual(paired['pairs'], 5) + self.assertEqual([row['iteration'] for row in paired['rows']], [1, 2, 3, 4, 5]) + self.assertEqual(paired['rows'][0], {'iteration': 1, 'baselineMs': 10, + 'candidateMs': 40, 'durationRatio': 4, 'durationDeltaMs': 30}) + + def test_duplicate_missing_or_invalid_pair_iterations_are_rejected(self): + for mutate in [lambda samples: samples.append(copy.deepcopy(samples[-1])), + lambda samples: samples[-1].update(iteration=99), + lambda samples: samples[-1].update(iteration=True), + lambda samples: samples[-1].pop('iteration')]: + samples = self.samples() + mutate(samples) + with self.assertRaises(ValueError): + compare(samples) def test_partial_duplicate_or_zero_time_is_rejected(self): for mutate in [lambda r: r["rows"].pop(), From bd0b0ddf31acb349257976820b384eddad37fc90 Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 01:40:08 +0200 Subject: [PATCH 07/11] =?UTF-8?q?=D7=9E=D7=93=D7=99=D7=93=D7=94:=20=D7=94?= =?UTF-8?q?=D7=9B=D7=9F=20=D7=AA=D7=9C=D7=95=D7=99=D7=95=D7=AA=20native=20?= =?UTF-8?q?=D7=9E=D7=90=D7=95=D7=9E=D7=AA=D7=95=D7=AA=20=D7=91=D7=9B=D7=9C?= =?UTF-8?q?=20=D7=A6=D7=93=20=D7=9C=D7=A4=D7=A0=D7=99=20profile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/perf_probe/run_indexing_pair.py | 12 +++++++++++- tool/perf_probe/test_indexing_pair.py | 27 ++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/tool/perf_probe/run_indexing_pair.py b/tool/perf_probe/run_indexing_pair.py index 2b7f4be462..020daf9ecb 100644 --- a/tool/perf_probe/run_indexing_pair.py +++ b/tool/perf_probe/run_indexing_pair.py @@ -9,6 +9,7 @@ import shutil import statistics import subprocess +import sys import tempfile @@ -16,6 +17,8 @@ PROFILE_TARGET = "integration_test/indexing_native_probe_test.dart" PROFILE_DRIVER = "test_driver/indexing_native_probe.dart" PROFILE_WINDOW_SUPPORT = "integration_test/support/webview_probe_window.dart" +PROFILE_BUILD_HELPER = "tool/ci/prepare_native_build_dependencies.py" +PROFILE_BUILD_SUPPORT = [PROFILE_BUILD_HELPER, "tool/release/download_release_asset.sh"] SUPPORT = [HARNESS, "integration_test/support/installed_plugin_pdf_fixture.dart", "test/support/search_engine_test_init.dart", "test/test_helpers/memory_cache_provider.dart"] @@ -48,6 +51,9 @@ def profile_artifact_hashes(executable): def prepare_profile_application(flutter, checkout, log): executable = checkout / 'build/windows/x64/runner/Profile/otzaria.exe' executable.parent.mkdir(parents=True, exist_ok=True) + command([sys.executable, '-B', PROFILE_BUILD_HELPER, '--project-root', str(checkout), + '--platform', 'windows', '--arch', 'x64', '--mode', 'profile', '--with-sentry'], + checkout, log.with_name(log.stem + '-dependencies' + log.suffix)) command(profile_build_command(flutter), checkout, log) (executable.parent / 'portable.marker').touch() return executable, profile_artifact_hashes(executable) @@ -227,7 +233,8 @@ def main(): checkout = scratch / role command(["git", "worktree", "add", "--detach", str(checkout), commit], root) snapshots[role] = checkout - support = SUPPORT + ([PROFILE_TARGET, PROFILE_DRIVER, PROFILE_WINDOW_SUPPORT] + support = SUPPORT + ([PROFILE_TARGET, PROFILE_DRIVER, PROFILE_WINDOW_SUPPORT, + *PROFILE_BUILD_SUPPORT] if args.mode == 'profile' else []) for relative in support: target = checkout / relative @@ -287,6 +294,9 @@ def main(): "profileApplications": {role: {'executable': str(executable), 'sha256': profile_artifacts[role]} for role, executable in profile_applications.items()}, + "profilePreparationSha256": {relative: hashlib.sha256((root / relative).read_bytes()).hexdigest() + for relative in PROFILE_BUILD_SUPPORT} + if args.mode == 'profile' else {}, "lockSha256": locks[0], "harnessSha256": hashlib.sha256((root / HARNESS).read_bytes()).hexdigest(), "limitations": ["Flutter test debug harness; not release app performance" if args.mode == 'debug' diff --git a/tool/perf_probe/test_indexing_pair.py b/tool/perf_probe/test_indexing_pair.py index e8def01364..b05bf41517 100644 --- a/tool/perf_probe/test_indexing_pair.py +++ b/tool/perf_probe/test_indexing_pair.py @@ -2,12 +2,13 @@ import hashlib import json from pathlib import Path +import sys import tempfile import unittest from unittest.mock import patch from tool.perf_probe.run_indexing_pair import ( - CASES, compare, measurement_command, prepare_profile_application, + CASES, PROFILE_BUILD_HELPER, compare, measurement_command, prepare_profile_application, profile_artifact_hashes, profile_build_command, validate, validate_profile_pair, verify_profile_artifacts, ) @@ -59,11 +60,20 @@ def test_profile_build_creates_portable_bundle_after_build_before_launch(self): with tempfile.TemporaryDirectory() as temporary: checkout = Path(temporary) executable = checkout / 'build/windows/x64/runner/Profile/otzaria.exe' + operations = [] def build(args, cwd, log): - self.assertEqual(args, profile_build_command('flutter')) self.assertEqual(cwd, checkout) self.assertFalse((executable.parent / 'portable.marker').exists()) + if not operations: + self.assertEqual(args, [sys.executable, '-B', PROFILE_BUILD_HELPER, + '--project-root', str(checkout), '--platform', 'windows', + '--arch', 'x64', '--mode', 'profile', '--with-sentry']) + operations.append('prepare') + return + self.assertEqual(operations, ['prepare']) + self.assertEqual(args, profile_build_command('flutter')) + operations.append('build') executable.write_bytes(b'launcher') (executable.parent / 'data').mkdir() (executable.parent / 'data/app.so').write_bytes(b'aot') @@ -71,7 +81,8 @@ def build(args, cwd, log): with patch('tool.perf_probe.run_indexing_pair.command', side_effect=build) as mocked: actual, hashes = prepare_profile_application('flutter', checkout, checkout / 'build.log') - mocked.assert_called_once() + self.assertEqual(mocked.call_count, 2) + self.assertEqual(operations, ['prepare', 'build']) self.assertEqual(actual, executable) self.assertTrue((executable.parent / 'portable.marker').is_file()) self.assertEqual(set(hashes), {'otzaria.exe', 'data/app.so', 'flutter_windows.dll'}) @@ -90,6 +101,16 @@ def build(args, cwd, log): with self.assertRaisesRegex(ValueError, 'portable.marker'): profile_artifact_hashes(executable) + def test_profile_dependency_failure_does_not_start_build(self): + with tempfile.TemporaryDirectory() as temporary: + checkout = Path(temporary) + with patch('tool.perf_probe.run_indexing_pair.command', + side_effect=RuntimeError('Dependency download failed')) as mocked: + with self.assertRaisesRegex(RuntimeError, 'Dependency download failed'): + prepare_profile_application('flutter', checkout, checkout / 'build.log') + mocked.assert_called_once() + self.assertEqual(mocked.call_args.args[0][2], PROFILE_BUILD_HELPER) + def test_profile_pair_requires_identical_flutter_engine(self): baseline = {'otzaria.exe': 'a', 'data/app.so': 'b', 'flutter_windows.dll': 'c'} candidate = {'otzaria.exe': 'd', 'data/app.so': 'e', 'flutter_windows.dll': 'c'} From 163a904d535c0ab4803aaba2793417c74d9101af Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 01:52:49 +0200 Subject: [PATCH 08/11] =?UTF-8?q?CI:=20=D7=A9=D7=9E=D7=95=D7=A8=20=D7=94?= =?UTF-8?q?=D7=A2=D7=A8=D7=95=D7=AA=20CMake=20=D7=9C=D7=A6=D7=93=20=D7=A2?= =?UTF-8?q?=D7=A8=D7=9B=D7=99=D7=9D=20=D7=91=D7=A2=D7=AA=20=D7=94=D7=9B?= =?UTF-8?q?=D7=A0=D7=AA=20=D7=AA=D7=9C=D7=95=D7=99=D7=95=D7=AA=20=D7=97?= =?UTF-8?q?=D7=95=D7=96=D7=A8=D7=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/ci/prepare_native_build_dependencies.py | 15 +++++++- .../test_prepare_native_build_dependencies.py | 37 ++++++++++++++++--- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/tool/ci/prepare_native_build_dependencies.py b/tool/ci/prepare_native_build_dependencies.py index 4458b96375..fa42b6a422 100644 --- a/tool/ci/prepare_native_build_dependencies.py +++ b/tool/ci/prepare_native_build_dependencies.py @@ -195,8 +195,19 @@ def write_cmake_cache(build_directory, values): value = directory.as_posix() if any(character in value for character in ("\r", "\n", ";")): raise ValueError("Dependency path cannot contain a CMake list or line separator") - lines = [line for line in lines if not re.match(rf"^{key}:[^=]*=", line)] - lines.append(f"{key}:PATH={value}") + positions = [index for index, line in enumerate(lines) + if re.match(rf"^{re.escape(key)}:[^=]*=", line)] + entry = f"{key}:PATH={value}" + if positions: + lines[positions[0]] = entry + for index in reversed(positions[1:]): + start = index + # CMake requires each help block to be followed by an entry. + while start > 0 and lines[start - 1].startswith("//"): + start -= 1 + del lines[start:index + 1] + else: + lines.append(entry) descriptor, temporary_name = tempfile.mkstemp(prefix="cache-", dir=build_directory) os.close(descriptor) temporary = Path(temporary_name) diff --git a/tool/ci/test_prepare_native_build_dependencies.py b/tool/ci/test_prepare_native_build_dependencies.py index 22f835b2b5..c59ebbcebb 100644 --- a/tool/ci/test_prepare_native_build_dependencies.py +++ b/tool/ci/test_prepare_native_build_dependencies.py @@ -251,6 +251,33 @@ def test_line_and_cmake_list_injection_preserves_cache(self): native.write_cmake_cache(build, {"PRINTING_PDFIUM_DIR": self.root / suffix}) self.assertEqual(cache.read_text(), "KEEP:BOOL=ON\n") + def test_cache_replacement_preserves_help_and_entry_position(self): + build = self.root / "build" + build.mkdir() + cache = build / "CMakeCache.txt" + original = ("// Existing dependency path\n// and its second help line\n" + "PRINTING_PDFIUM_DIR:PATH=old\n\n" + "// Unrelated setting\nKEEP:STRING=hello\n") + cache.write_text(original) + native.write_cmake_cache(build, {"PRINTING_PDFIUM_DIR": self.printing}) + self.assertEqual(cache.read_text(), original.replace( + "PRINTING_PDFIUM_DIR:PATH=old", f"PRINTING_PDFIUM_DIR:PATH={self.printing.as_posix()}")) + + def test_cache_duplicate_entries_remove_their_help_without_orphaning_it(self): + build = self.root / "build" + build.mkdir() + cache = build / "CMakeCache.txt" + cache.write_text("// First help\nPRINTING_PDFIUM_DIR:PATH=first\n\n" + "// Duplicate help\n// second line\nPRINTING_PDFIUM_DIR:PATH=second\n\n" + "// Unrelated help\nKEEP:BOOL=ON\n") + native.write_cmake_cache(build, {"PRINTING_PDFIUM_DIR": self.printing}) + result = cache.read_text() + self.assertTrue(result.startswith(f"// First help\nPRINTING_PDFIUM_DIR:PATH={self.printing.as_posix()}\n")) + self.assertEqual(result.count("PRINTING_PDFIUM_DIR:"), 1) + self.assertNotIn("// Duplicate help", result) + self.assertNotIn("// second line", result) + self.assertIn("// Unrelated help\nKEEP:BOOL=ON\n", result) + @unittest.skipUnless(shutil.which("cmake"), "CMake is required for the real configuration control") def test_real_cmake_consumes_prepared_sources_twice_without_network(self): source = self.root / "cmake project" @@ -279,12 +306,12 @@ def test_real_cmake_consumes_prepared_sources_twice_without_network(self): sentry_source = self.root / "sentry source" sentry_source.mkdir() (sentry_source / "CMakeLists.txt").write_text("add_library(sentry INTERFACE)\n") - native.write_cmake_cache(build, { - "PRINTING_PDFIUM_DIR": self.printing, - "FETCHCONTENT_SOURCE_DIR_NLOHMANN_JSON": json_source, - "FETCHCONTENT_SOURCE_DIR_SN": sentry_source, - }) for _ in range(2): + native.write_cmake_cache(build, { + "PRINTING_PDFIUM_DIR": self.printing, + "FETCHCONTENT_SOURCE_DIR_NLOHMANN_JSON": json_source, + "FETCHCONTENT_SOURCE_DIR_SN": sentry_source, + }) result = subprocess.run(["cmake", "-S", str(source), "-B", str(build)], capture_output=True, text=True) self.assertEqual(result.returncode, 0, result.stdout + result.stderr) From 17ede2f045f3c759c2b14d99a6d1e980713c117d Mon Sep 17 00:00:00 2001 From: ypl <7353755@gmail.com> Date: Wed, 2 Dec 2026 02:21:29 +0200 Subject: [PATCH 09/11] =?UTF-8?q?=D7=90=D7=99=D7=A0=D7=93=D7=95=D7=A7?= =?UTF-8?q?=D7=A1:=20=D7=94=D7=A6=D7=92=20=D7=90=D7=AA=20=D7=97=D7=99?= =?UTF-8?q?=D7=9C=D7=95=D7=A5=20=D7=94=D6=BEPDF=20=D7=94=D7=A8=D7=90=D7=A9?= =?UTF-8?q?=D7=95=D7=9F=20=D7=95=D7=AA=D7=97=D7=95=D7=9D=20=D7=90=D7=AA=20?= =?UTF-8?q?=D7=A0=D7=99=D7=A1=D7=95=D7=99=20=D7=94=D7=91=D7=99=D7=A6=D7=95?= =?UTF-8?q?=D7=A2=D7=99=D7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/scripts/ci-safety.test.cjs | 43 ++++++++++++++++ .github/workflows/perf_probe.yml | 50 +++++++++++++------ lib/indexing/bloc/indexing_state.dart | 17 +++++++ lib/indexing/indexing_work_status.dart | 3 ++ .../models/indexing_run_diagnostics.dart | 6 +++ .../repository/indexing_repository.dart | 34 +++++++------ lib/indexing/utils/indexing_crash_canary.dart | 15 ++++-- lib/navigation/view/main_window_screen.dart | 2 +- lib/search/view/search_dialog.dart | 1 + lib/settings/tabs/library_settings_tab.dart | 1 + lib/widgets/feedback/indexing_warning.dart | 1 + test/indexing/bloc/indexing_bloc_test.dart | 24 +++++++++ test/indexing/bloc/indexing_state_test.dart | 12 +++++ .../utils/indexing_crash_canary_test.dart | 2 + .../indexing_native_probe_test.dart | 2 +- 15 files changed, 177 insertions(+), 36 deletions(-) diff --git a/.github/scripts/ci-safety.test.cjs b/.github/scripts/ci-safety.test.cjs index 9da3438392..c561064dfb 100644 --- a/.github/scripts/ci-safety.test.cjs +++ b/.github/scripts/ci-safety.test.cjs @@ -532,3 +532,46 @@ for (const kind of ['squash', 'rebase', 'merge', 'direct']) { if (kind === 'rebase') assert.equal(existsSync(path.join(repo, 'feature-A')), true); }); } + +test('indexing before/after proof runs only while introducing the probe', t => { + const workflow = readFileSync(path.join(workflows, 'perf_probe.yml'), 'utf8'); + const selector = scripts('perf_probe.yml').find(script => + script.includes('run_indexing_pair.py') && script.includes('git ls-tree')); + assert.ok(selector, 'Run the PR-only comparison only if the probe is new to the base'); + assert.match(workflow, /needs\.contracts\.outputs\.indexing_probe_added == 'true'/); + assert.match(workflow, /github\.event_name == 'workflow_dispatch' && inputs\.indexing_baseline != ''/); + assert.match(workflow, /if: github\.event_name == 'pull_request'\s+shell: pwsh\s+env:[\s\S]*?verify_indexing_recovery_regression\.py/); + const dir = mkdtempSync(path.join(tmpdir(), 'otzaria-indexing-probe-')); + t.after(() => rmSync(dir, { recursive: true, force: true })); + const git = (...args) => { + const result = spawnSync('git', ['-C', dir, ...args], { encoding: 'utf8' }); + assert.equal(result.status, 0, result.stderr); + return result.stdout.trim(); + }; + git('init', '-q'); + git('config', 'user.name', 'CI Test'); + git('config', 'user.email', 'ci-test@example.invalid'); + git('remote', 'add', 'origin', dir); + writeFileSync(path.join(dir, 'pubspec.lock'), 'original'); + git('add', '.'); + git('commit', '-qm', 'base before the probe'); + const before = git('rev-parse', 'HEAD'); + mkdirSync(path.join(dir, 'tool/perf_probe'), { recursive: true }); + writeFileSync(path.join(dir, 'tool/perf_probe/run_indexing_pair.py'), '# installed'); + git('add', '.'); + git('commit', '-qm', 'base after the probe'); + const after = git('rev-parse', 'HEAD'); + writeFileSync(path.join(dir, 'pubspec.lock'), 'changed candidate lock'); + git('commit', '-qam', 'future PR with different dependencies'); + + for (const [base, expected] of [[before, 'added=true'], [after, 'added=false']]) { + const output = path.join(dir, base); + const result = spawnSync('bash', ['-e', '-c', selector], { + cwd: dir, + env: { ...process.env, INDEX_BASELINE: base, GITHUB_OUTPUT: output }, + encoding: 'utf8', + }); + assert.equal(result.status, 0, result.stdout + result.stderr); + assert.equal(readFileSync(output, 'utf8').trim(), expected); + } +}); diff --git a/.github/workflows/perf_probe.yml b/.github/workflows/perf_probe.yml index d6580c579c..88d4114e8a 100644 --- a/.github/workflows/perf_probe.yml +++ b/.github/workflows/perf_probe.yml @@ -3,16 +3,9 @@ name: Performance probe tools on: pull_request: paths: - - 'lib/indexing/**' - - 'lib/migration/services/external_book_import.dart' - - 'lib/utils/file/docx_cache.dart' - - 'lib/utils/file/document_converter.dart' - 'test/tool/perf_probe/indexing_native_probe_test.dart' - 'integration_test/indexing_native_probe_test.dart' - 'test_driver/indexing_native_probe.dart' - - 'tool/perf_probe/run_indexing_pair.py' - - 'tool/perf_probe/test_indexing_pair.py' - - 'tool/perf_probe/verify_indexing_recovery_regression.py' - 'tool/perf_probe/**' - 'tool/ci/prepare_native_build_dependencies.py' - 'tool/release/download_release_asset.sh' @@ -58,6 +51,9 @@ on: - '.github/workflows/perf_probe.yml' workflow_dispatch: inputs: + indexing_baseline: + description: Run indexing comparisons against this optional full baseline SHA + type: string mode: description: Build mode (results are never compared across modes) type: choice @@ -103,32 +99,40 @@ concurrency: jobs: indexing_pair: name: Native indexing pairs (debug and profile, same Windows host) - needs: gate - if: github.event_name == 'pull_request' && needs.gate.outputs.run == 'true' + needs: [gate, contracts] + if: >- + needs.gate.outputs.run == 'true' && + (needs.contracts.outputs.indexing_probe_added == 'true' || + (github.event_name == 'workflow_dispatch' && inputs.indexing_baseline != '')) runs-on: windows-2025 timeout-minutes: 90 steps: - uses: actions/checkout@v7.0.1 with: - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 0 - uses: ./.github/actions/setup-flutter with: flutter-version: 3.47.9 - uses: dtolnay/rust-toolchain@stable - - name: Validate comparison contracts - run: python -B -m unittest tool.perf_probe.test_indexing_pair -v - - name: Compare immutable sources with alternating launches + - name: Prove the original recovery regression + if: github.event_name == 'pull_request' shell: pwsh env: INDEX_BASELINE: ${{ github.event.pull_request.base.sha }} - INDEX_CANDIDATE: ${{ github.event.pull_request.head.sha }} run: | git config --global core.longpaths true flutter pub get --enforce-lockfile if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } python -B tool/perf_probe/verify_indexing_recovery_regression.py --baseline $env:INDEX_BASELINE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair/regression') if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Compare immutable sources with alternating launches + shell: pwsh + env: + INDEX_BASELINE: ${{ github.event.pull_request.base.sha || inputs.indexing_baseline }} + INDEX_CANDIDATE: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + git config --global core.longpaths true python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair') --warmups 1 --repetitions 5 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } python -B tool/perf_probe/run_indexing_pair.py --baseline $env:INDEX_BASELINE --candidate $env:INDEX_CANDIDATE --output (Join-Path $env:RUNNER_TEMP 'indexing-pair/profile') --mode profile --pdf-pages 600 --warmups 1 --repetitions 5 @@ -154,8 +158,26 @@ jobs: if: needs.gate.outputs.run == 'true' runs-on: ubuntu-latest timeout-minutes: 5 + outputs: + indexing_probe_added: ${{ steps.indexing_probe.outputs.added }} steps: - uses: actions/checkout@v7.0.1 + - name: Detect the first indexing probe comparison + id: indexing_probe + if: github.event_name == 'pull_request' + env: + INDEX_BASELINE: ${{ github.event.pull_request.base.sha }} + run: | + git cat-file -e "${INDEX_BASELINE}^{commit}" || + git fetch --no-tags --depth=1 origin "$INDEX_BASELINE" + probe=$(git ls-tree "$INDEX_BASELINE" -- tool/perf_probe/run_indexing_pair.py) + if [ -z "$probe" ]; then + echo 'added=true' >> "$GITHUB_OUTPUT" + else + echo 'added=false' >> "$GITHUB_OUTPUT" + fi + - name: Validate indexing comparison contracts + run: python3 -B -m unittest tool.perf_probe.test_indexing_pair -v - name: Validate process identity and invariant CSV formatting shell: pwsh run: ./tool/perf_probe/test_sample_resources.ps1 diff --git a/lib/indexing/bloc/indexing_state.dart b/lib/indexing/bloc/indexing_state.dart index a0380ddd5e..4d55d57bc4 100644 --- a/lib/indexing/bloc/indexing_state.dart +++ b/lib/indexing/bloc/indexing_state.dart @@ -48,6 +48,23 @@ class IndexingInProgress extends IndexingState { final int? pdfPagesProcessed; final int? pdfTotalPages; + /// מסנן עדכוני עמודים אצל צרכנים שמציגים רק התקדמות של ספרים. + static bool bookProgressChanged( + IndexingState previous, + IndexingState current, + ) { + if (previous is! IndexingInProgress || current is! IndexingInProgress) { + return true; + } + return previous.booksProcessed != current.booksProcessed || + previous.totalBooks != current.totalBooks || + previous.isCreatingIndex != current.isCreatingIndex || + previous.isScanning != current.isScanning || + previous.isPaused != current.isPaused || + previous.isEconomy != current.isEconomy || + previous.isFinalizing != current.isFinalizing; + } + @override List get props => [ ...super.props, diff --git a/lib/indexing/indexing_work_status.dart b/lib/indexing/indexing_work_status.dart index 3fbe03b75a..1e35df7954 100644 --- a/lib/indexing/indexing_work_status.dart +++ b/lib/indexing/indexing_work_status.dart @@ -6,6 +6,9 @@ import 'package:otzaria/work_status/work_status_item.dart'; /// מזהה פריט חיווי העבודה של האינדוקס. const kIndexingWorkStatusId = 'indexing'; +bool shouldShowIndexingWorkStatus(IndexingInProgress state) => + state.isCreatingIndex || state.isScanning || state.pdfTotalPages != null; + /// פריט חיווי העבודה לאינדוקס, כולל לחצני השהיה/המשך ומצב חסכוני /// (issue #834). WorkStatusItem indexingWorkStatusItem( diff --git a/lib/indexing/models/indexing_run_diagnostics.dart b/lib/indexing/models/indexing_run_diagnostics.dart index fa40146e46..9730a6d1dc 100644 --- a/lib/indexing/models/indexing_run_diagnostics.dart +++ b/lib/indexing/models/indexing_run_diagnostics.dart @@ -73,6 +73,7 @@ class IndexingRunDiagnosticsCollector { final _stageTimes = {}; final _counters = {}; final _resourceDecisions = []; + IndexingResourcePolicy? _lastPolicy; bool recoveryStarted = false; void addTime(IndexingStage stage, Duration elapsed) { @@ -104,6 +105,11 @@ class IndexingRunDiagnosticsCollector { IndexingResourcePolicy policy, IndexingResourceMode mode, ) { + if (identical(_lastPolicy, policy) && + _resourceDecisions.last.mode == mode) { + return; + } + _lastPolicy = policy; final decision = IndexingResourceDecision(policy, mode); if (_resourceDecisions.isEmpty || _resourceDecisions.last != decision) { _resourceDecisions.add(decision); diff --git a/lib/indexing/repository/indexing_repository.dart b/lib/indexing/repository/indexing_repository.dart index d5b818e839..b8dab35099 100644 --- a/lib/indexing/repository/indexing_repository.dart +++ b/lib/indexing/repository/indexing_repository.dart @@ -1994,30 +1994,32 @@ class IndexingRepository { Duration pageTimeout = const Duration(seconds: 5), void Function(int processed, int total)? onProgress, }) async { - final progressClock = Stopwatch()..start(); + final progressClock = onProgress == null ? null : (Stopwatch()..start()); void report(int processed, {bool force = false}) { - if (force || progressClock.elapsedMilliseconds >= 250) { - onProgress?.call(processed, pageCount); + if (progressClock != null && + (force || progressClock.elapsedMilliseconds >= 250)) { + onProgress!(processed, pageCount); progressClock.reset(); } } report(0, force: true); final pending = >{}; + // Future דוחה null ב-timeout גם כשהמשתנה הוא Future. + final deadline = Object(); Future load(int index) async { - final future = pending[index] ??= loadPageText( - index, - ).then((text) => text); - var timedOut = false; - final text = await future.timeout( - pageTimeout, - onTimeout: () { - timedOut = true; - return null; - }, - ); - if (!timedOut) pending.remove(index); - return text; + final future = pending[index] ??= loadPageText(index); + try { + final text = await future.timeout( + pageTimeout, + onTimeout: () => throw deadline, + ); + pending.remove(index); + return text; + } catch (error) { + if (identical(error, deadline)) return null; + rethrow; + } } final texts = SplayTreeMap(); diff --git a/lib/indexing/utils/indexing_crash_canary.dart b/lib/indexing/utils/indexing_crash_canary.dart index 1d7636ae4f..d1942ad3b7 100644 --- a/lib/indexing/utils/indexing_crash_canary.dart +++ b/lib/indexing/utils/indexing_crash_canary.dart @@ -33,6 +33,7 @@ class IndexingCrashCanary { final keys = pendingKeys().toSet(); final previousCount = canary._attempts.length; canary._attempts.removeWhere((key, _) => !keys.contains(key)); + canary._recoveryKeys.retainAll(keys); if (canary._attempts.length != previousCount) canary._write(); } if (canary != null && canary.recovering) canary._logCrash(); @@ -53,7 +54,7 @@ class IndexingCrashCanary { bool _dirty = false; /// ריצה קודמת מתה באמצע: מאנדקסים ספר-ספר, כדי שרק האשם ייספר. - bool get recovering => _attempts.keys.any(_recoveryKeys.contains); + bool get recovering => _recoveryKeys.isNotEmpty; static Map _read(File file) { try { @@ -83,7 +84,7 @@ class IndexingCrashCanary { void end(String key) { if (_skipped.contains(key)) return; if (!_inFlight.remove(key)) return; - if (_attempts.remove(key) != null) _write(); + if (_removeAttempt(key)) _write(); } /// מסתיים כשכל השינויים עד עכשיו בדיסק. @@ -94,7 +95,7 @@ class IndexingCrashCanary { if (_skipped.isEmpty) return; final saved = _skipped.where(indexedKeys.contains).toList(); if (saved.isEmpty) return; - saved.forEach(_attempts.remove); + saved.forEach(_removeAttempt); _skipped.removeAll(saved); _write(); } @@ -102,10 +103,16 @@ class IndexingCrashCanary { /// מנקה רק ספרים שה-reader קרא מהאינדקס החתום בדיסק. void forgetIndexed(Iterable committedKeys) { final previousCount = _attempts.length; - committedKeys.forEach(_attempts.remove); + committedKeys.forEach(_removeAttempt); if (_attempts.length != previousCount) _write(); } + bool _removeAttempt(String key) { + if (_attempts.remove(key) == null) return false; + _recoveryKeys.remove(key); + return true; + } + /// הריצה הסתיימה (או התוכנה נסגרה) בלי שהתהליך מת — מה שבטיסה לא הפיל אותו. Future finish() { if (identical(current, this)) current = null; diff --git a/lib/navigation/view/main_window_screen.dart b/lib/navigation/view/main_window_screen.dart index 32b7eface6..03d6d06a0b 100644 --- a/lib/navigation/view/main_window_screen.dart +++ b/lib/navigation/view/main_window_screen.dart @@ -3381,7 +3381,7 @@ class MainWindowScreenState extends State listener: (context, state) { final cubit = context.read(); if (state is IndexingInProgress && - (state.isCreatingIndex || state.isScanning)) { + shouldShowIndexingWorkStatus(state)) { final indexingBloc = context.read(); cubit.upsert( indexingWorkStatusItem( diff --git a/lib/search/view/search_dialog.dart b/lib/search/view/search_dialog.dart index 141522656f..b660ac9340 100644 --- a/lib/search/view/search_dialog.dart +++ b/lib/search/view/search_dialog.dart @@ -2368,6 +2368,7 @@ class _IndexMissingGate extends StatelessWidget { valueListenable: TantivyDataProvider.instance.isInitialized, builder: (context, providerInitialized, _) => BlocBuilder( + buildWhen: IndexingInProgress.bookProgressChanged, builder: (context, state) => isSearchBlockedByMissingIndex( providerInitialized: providerInitialized, diff --git a/lib/settings/tabs/library_settings_tab.dart b/lib/settings/tabs/library_settings_tab.dart index 0fd8f3a401..a83858f615 100644 --- a/lib/settings/tabs/library_settings_tab.dart +++ b/lib/settings/tabs/library_settings_tab.dart @@ -739,6 +739,7 @@ class _LibrarySettingsTabState extends State { context.read().add(UpdateIndexingResourceMode(mode)), ), BlocBuilder( + buildWhen: IndexingInProgress.bookProgressChanged, builder: (context, indexingState) { final processed = indexingState.booksProcessed ?? 0; final total = indexingState.totalBooks ?? 0; diff --git a/lib/widgets/feedback/indexing_warning.dart b/lib/widgets/feedback/indexing_warning.dart index 9354c166aa..63edebf9cc 100644 --- a/lib/widgets/feedback/indexing_warning.dart +++ b/lib/widgets/feedback/indexing_warning.dart @@ -140,6 +140,7 @@ class IndexingWarningContainer extends StatelessWidget { valueListenable: TantivyDataProvider.instance.isIndexingDeferred, builder: (context, indexingDeferred, _) { return BlocBuilder( + buildWhen: IndexingInProgress.bookProgressChanged, builder: (context, state) { final mode = resolveIndexingWarningMode( state: state, diff --git a/test/indexing/bloc/indexing_bloc_test.dart b/test/indexing/bloc/indexing_bloc_test.dart index 9df5f0a1d6..0826429f03 100644 --- a/test/indexing/bloc/indexing_bloc_test.dart +++ b/test/indexing/bloc/indexing_bloc_test.dart @@ -9,6 +9,8 @@ import 'package:otzaria/core/messages/settings_messages.dart'; import 'package:otzaria/indexing/bloc/indexing_bloc.dart'; import 'package:otzaria/indexing/bloc/indexing_event.dart'; import 'package:otzaria/indexing/bloc/indexing_state.dart'; +import 'package:otzaria/indexing/indexing_work_status.dart'; +import 'package:otzaria/work_status/work_status_cubit.dart'; import 'package:otzaria/indexing/models/index_check_scope.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; import 'package:otzaria/indexing/repository/indexing_repository.dart'; @@ -49,6 +51,22 @@ void main() { bloc.add(StartIndexing(libraryWithBooks(), onSettled: settled.complete)); await repository.pdfReady.future; await pumpEventQueue(); + final status = WorkStatusCubit(); + addTearDown(status.close); + final subscription = bloc.stream.listen((state) { + if (state is IndexingInProgress && shouldShowIndexingWorkStatus(state)) { + status.upsert( + indexingWorkStatusItem( + state, + onTogglePause: () {}, + onToggleEconomy: () {}, + ), + ); + } else { + status.remove(kIndexingWorkStatusId); + } + }); + addTearDown(subscription.cancel); final report = repository.reportPdfProgress!; final progress = bloc.stream.firstWhere( (state) => state is IndexingInProgress && state.pdfPagesProcessed == 23, @@ -56,6 +74,11 @@ void main() { report(23, 120); final displayed = await progress as IndexingInProgress; expect(displayed.pdfTotalPages, 120); + expect(displayed.isCreatingIndex, isFalse); + expect( + status.state.items[kIndexingWorkStatusId]?.detail, + contains('23/120 עמודים'), + ); final paused = bloc.stream.firstWhere( (state) => state is IndexingInProgress && state.isPaused, ); @@ -64,6 +87,7 @@ void main() { final stopped = bloc.stream.firstWhere((state) => state is IndexingStopped); bloc.add(CancelIndexing()); await stopped; + expect(status.state.items, isEmpty); report(99, 120); await pumpEventQueue(); expect(bloc.state, isA()); diff --git a/test/indexing/bloc/indexing_state_test.dart b/test/indexing/bloc/indexing_state_test.dart index 7304f720b2..f4d7d93e88 100644 --- a/test/indexing/bloc/indexing_state_test.dart +++ b/test/indexing/bloc/indexing_state_test.dart @@ -8,6 +8,18 @@ void main() { const before = IndexingInProgress(pdfPagesProcessed: 1, pdfTotalPages: 100); const after = IndexingInProgress(pdfPagesProcessed: 2, pdfTotalPages: 100); expect(before, isNot(after)); + final hasBookProgress = IndexingInProgress.bookProgressChanged; + expect(hasBookProgress(before, after), isFalse); + expect(hasBookProgress(after, const IndexingInProgress()), isFalse); + expect( + hasBookProgress(after, const IndexingInProgress(booksProcessed: 1)), + isTrue, + ); + expect( + hasBookProgress(after, const IndexingInProgress(isFinalizing: true)), + isTrue, + ); + expect(hasBookProgress(after, const IndexingComplete()), isTrue); }); const failure = IndexingFailure( bookTitle: 'ספר', diff --git a/test/indexing/utils/indexing_crash_canary_test.dart b/test/indexing/utils/indexing_crash_canary_test.dart index 2820cda8b3..12e2acac1e 100644 --- a/test/indexing/utils/indexing_crash_canary_test.dart +++ b/test/indexing/utils/indexing_crash_canary_test.dart @@ -31,6 +31,8 @@ void main() { expect(jsonDecode(File('$index.in_flight.json').readAsStringSync()), { 'new': 1, }); + expect(canary.begin('old'), isTrue); + expect(canary.recovering, isFalse); }); test('דילוג על חשוד נשאר בהתאוששות עד שנחתם', () async { diff --git a/test/tool/perf_probe/indexing_native_probe_test.dart b/test/tool/perf_probe/indexing_native_probe_test.dart index 7cdb0f5dad..f756222440 100644 --- a/test/tool/perf_probe/indexing_native_probe_test.dart +++ b/test/tool/perf_probe/indexing_native_probe_test.dart @@ -169,7 +169,7 @@ Future> runNativeIndexingMeasurement(String output) async { final hits = await engine.searchExact( query: pdf ? installedPdfQuery : 'benchmarktoken', facets: const [], - limit: expected, + limit: expected + 1, offset: 0, order: ResultsOrder.catalogue, matchNikud: false, From 27e605e12b454ed682030847d4cab0213f1286ad Mon Sep 17 00:00:00 2001 From: palmoni5 Date: Wed, 2 Dec 2026 02:39:12 +0200 Subject: [PATCH 10/11] =?UTF-8?q?=D7=90=D7=99=D7=A0=D7=93=D7=95=D7=A7?= =?UTF-8?q?=D7=A1:=20=D7=94=D7=A6=D7=92=20=D7=94=D7=AA=D7=A7=D7=93=D7=9E?= =?UTF-8?q?=D7=95=D7=AA=20=D7=92=D7=9D=20=D7=91=D7=A0=D7=99=D7=A1=D7=99?= =?UTF-8?q?=D7=95=D7=A0=D7=95=D7=AA=20=D7=97=D7=95=D7=96=D7=A8=D7=99=D7=9D?= =?UTF-8?q?=20=D7=9C=D7=97=D7=99=D7=9C=D7=95=D7=A5=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../issue6187/retry-compact-dark.png | Bin 0 -> 13266 bytes .../issue6187/retry-compact-light.png | Bin 0 -> 13236 bytes .../issue6187/retry-desktop-dark.png | Bin 0 -> 14817 bytes .../issue6187/retry-desktop-light.png | Bin 0 -> 14968 bytes lib/indexing/bloc/indexing_bloc.dart | 21 ++- lib/indexing/bloc/indexing_event.dart | 8 +- lib/indexing/bloc/indexing_state.dart | 4 + lib/indexing/indexing_work_status.dart | 6 +- .../models/pdf_indexing_progress.dart | 19 +++ .../repository/indexing_repository.dart | 49 +++++-- test/indexing/bloc/indexing_bloc_test.dart | 96 ++++++++++++- test/indexing/indexing_work_status_test.dart | 16 +++ .../repository/indexing_repository_test.dart | 7 +- .../repository/pdf_text_timeout_test.dart | 134 +++++++++++++++++- .../indexing_progress_capture_test.dart | 27 +++- 15 files changed, 351 insertions(+), 36 deletions(-) create mode 100644 docs/screenshots/issue6187/retry-compact-dark.png create mode 100644 docs/screenshots/issue6187/retry-compact-light.png create mode 100644 docs/screenshots/issue6187/retry-desktop-dark.png create mode 100644 docs/screenshots/issue6187/retry-desktop-light.png create mode 100644 lib/indexing/models/pdf_indexing_progress.dart diff --git a/docs/screenshots/issue6187/retry-compact-dark.png b/docs/screenshots/issue6187/retry-compact-dark.png new file mode 100644 index 0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IRQGlyXWz=T;X&cCthp)-_?HpMB$#1>#ge? zX{Wx&tDL(97X(xwV@N?aoo-`EMBl}c@l=?CeDyyN(bVKSpS;)@^Qy+@S{?&}I#VgB zz9eySNHcspphurNZFV?_ zlda49FZY^UfOlCofi0Fw0AfJGxf17qa@oKHHu{3V_J8Z08t{%oWo2b*VxoVqAss|j z1nl%&39vIVNdvJbadKVN)Th!g;uw|F0Fdcbm%v*VKWvLFErHu8>7(du0{1=l$z;Dr z(qJG-;QfvM0TC1uK!13VA46B&o6}4Q@$2uMLCIKrxAw7cMd`|#1eou))0~WyhnjOK zWi98`6h8a|ftU$WcWkDA!#1}Qpx%5w@7CTP;mgu7h>Xz_qpBoZJ7L6~ zYEVM1O~kN2I0kV5KmX3^pbz literal 0 HcmV?d00001 diff --git a/docs/screenshots/issue6187/retry-desktop-light.png b/docs/screenshots/issue6187/retry-desktop-light.png new file mode 100644 index 0000000000000000000000000000000000000000..39100c65fb1b00523b93442571a21d10228ab2ae GIT binary patch literal 14968 zcmeIZcTkgG*Df4I0a3)p59z2V0@9=@5UPNocaSO~y$hiSP*4N~q$|CL&_eG;EFd5? zKp>HzB2q$#KH7>&+Y#iy8oCBaE1T4%>V0fVJ;PtG}qTVXrx3q zHRs@1T2ht!gXtKgDs$rSDZ{B(dJnzWpTAJOzqaZJgFqyL<>#IU&M}Ug*(zmkUiZ|G zD)DfcmeD(W+T}9Uht5lCSTnMGj7g|NEO99)f?o;3ry=1E6t_3&TLg7;GXzRrSi?W`?$RgJj#SaYyv zN=nLk+GCK|VsNLuz5UX+g2p&*O;d0|qvml)?vzWoqFE&ZW^rk{oki&!0REs zKp-VW;o&@UnRix5w;>Rx)Fn>(b)Coj;rav!#QMUy%gRh3sKAZLie^DIZ&BC5NlZ;j zj!x>Oz}7PmNO}=1tNkTvv>DzHkT~aHZ!h&liuyHtcioJqZptm_7dO+=aGpdXoGISR_jeK54A#<+0%KuW?$ zNr@9iZ{ad+L4H2;!3FB$%~E^lQoI?TM=D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!c7RK9sPQLTP0s*{p*@Y>FPEq%P8uJ3sLoEm7-HxS{jm~LT6;)W;oTW3>M}}JYEM|&(@qr zG&+P1#z#dI9q+;Qy}YXawS~p?&%gF2I&lRIQnSMU%Qh>P95HpZ|2R;=Z|YGS4^!2- KSE>B)+5Z6I2ur*G literal 0 HcmV?d00001 diff --git a/lib/indexing/bloc/indexing_bloc.dart b/lib/indexing/bloc/indexing_bloc.dart index 268519d47d..9783205ba4 100644 --- a/lib/indexing/bloc/indexing_bloc.dart +++ b/lib/indexing/bloc/indexing_bloc.dart @@ -1,3 +1,5 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; + import 'dart:async'; import 'package:bloc_concurrency/bloc_concurrency.dart'; @@ -31,6 +33,7 @@ class IndexingBloc extends Bloc { bool _isFinalizing = false; int? _pdfPagesProcessed; int? _pdfTotalPages; + PdfIndexingPhase _pdfPhase = PdfIndexingPhase.extraction; // ביטול מנקז את ריצות האינדוקס שכבר בתור: הן נשלחו לפני שהמשתמש עצר. final _enqueuedAtCancelCount = Expando(); @@ -103,6 +106,7 @@ class IndexingBloc extends Bloc { isFinalizing: _isFinalizing, pdfPagesProcessed: _pdfPagesProcessed, pdfTotalPages: _pdfTotalPages, + pdfPhase: _pdfPhase, ); Future _onIndexingWork( @@ -275,6 +279,7 @@ class IndexingBloc extends Bloc { final workId = ++_nextWorkId; _pdfPagesProcessed = null; _pdfTotalPages = null; + _pdfPhase = PdfIndexingPhase.extraction; final runClock = Stopwatch()..start(); _activeWorkId = workId; @@ -307,9 +312,9 @@ class IndexingBloc extends Bloc { }, onActualIndexingStarted: () => add(ActualIndexingStarted(workId)), onProgress: _progressOf(workId), - onPdfProgress: (processed, total) { + onPdfProgress: (progress) { if (!isClosed && _activeWorkId == workId) { - add(UpdatePdfIndexingProgress(workId, processed, total)); + add(UpdatePdfIndexingProgress(workId, progress)); } }, onFinalizing: () => add(IndexingFinalizing(workId)), @@ -384,6 +389,7 @@ class IndexingBloc extends Bloc { _isFinalizing = true; _pdfPagesProcessed = null; _pdfTotalPages = null; + _pdfPhase = PdfIndexingPhase.extraction; emit( _inProgress( booksProcessed: currentState.booksProcessed, @@ -475,6 +481,7 @@ class IndexingBloc extends Bloc { _activeWorkId = null; _pdfPagesProcessed = null; _pdfTotalPages = null; + _pdfPhase = PdfIndexingPhase.extraction; _isPaused = false; _cancelCount++; _repository.cancelIndexing(); @@ -566,10 +573,14 @@ class IndexingBloc extends Bloc { _isFinalizing) { return; } - _pdfTotalPages = event.total > 0 ? event.total : null; - _pdfPagesProcessed = event.total > 0 - ? event.processed.clamp(0, event.total) + final progress = event.progress; + _pdfTotalPages = progress != null && progress.total > 0 + ? progress.total : null; + _pdfPagesProcessed = _pdfTotalPages == null + ? null + : progress!.processed.clamp(0, progress.total); + _pdfPhase = progress?.phase ?? PdfIndexingPhase.extraction; _reemitProgressFlags(emit); } } diff --git a/lib/indexing/bloc/indexing_event.dart b/lib/indexing/bloc/indexing_event.dart index eb918a5804..0de7ca8328 100644 --- a/lib/indexing/bloc/indexing_event.dart +++ b/lib/indexing/bloc/indexing_event.dart @@ -1,3 +1,4 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; import 'package:equatable/equatable.dart'; import 'package:otzaria/indexing/models/index_check_scope.dart'; import 'package:otzaria/library/models/library.dart'; @@ -209,12 +210,11 @@ class UpdateIndexingProgress extends IndexingEvent { } class UpdatePdfIndexingProgress extends IndexingEvent { - const UpdatePdfIndexingProgress(this.workId, this.processed, this.total); + const UpdatePdfIndexingProgress(this.workId, this.progress); final int workId; - final int processed; - final int total; + final PdfIndexingProgress? progress; @override - List get props => [workId, processed, total]; + List get props => [workId, progress]; } diff --git a/lib/indexing/bloc/indexing_state.dart b/lib/indexing/bloc/indexing_state.dart index 4d55d57bc4..8bfbf41ef9 100644 --- a/lib/indexing/bloc/indexing_state.dart +++ b/lib/indexing/bloc/indexing_state.dart @@ -1,3 +1,4 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; import 'package:equatable/equatable.dart'; import 'package:otzaria/indexing/models/indexing_run_result.dart'; @@ -29,6 +30,7 @@ class IndexingInProgress extends IndexingState { this.isFinalizing = false, this.pdfPagesProcessed, this.pdfTotalPages, + this.pdfPhase = PdfIndexingPhase.extraction, }); /// שלב הבדיקה של ריצת אינדוקס — אילו ספרים מאונדקסים התיישנו. @@ -47,6 +49,7 @@ class IndexingInProgress extends IndexingState { final int? pdfPagesProcessed; final int? pdfTotalPages; + final PdfIndexingPhase pdfPhase; /// מסנן עדכוני עמודים אצל צרכנים שמציגים רק התקדמות של ספרים. static bool bookProgressChanged( @@ -74,6 +77,7 @@ class IndexingInProgress extends IndexingState { isFinalizing, pdfPagesProcessed, pdfTotalPages, + pdfPhase, ]; } diff --git a/lib/indexing/indexing_work_status.dart b/lib/indexing/indexing_work_status.dart index 1e35df7954..494900ac42 100644 --- a/lib/indexing/indexing_work_status.dart +++ b/lib/indexing/indexing_work_status.dart @@ -1,3 +1,4 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; import 'package:fluentui_system_icons/fluentui_system_icons.dart'; import 'package:flutter/foundation.dart'; import 'package:otzaria/indexing/bloc/indexing_state.dart'; @@ -38,12 +39,15 @@ WorkStatusItem indexingWorkStatusItem( } else { message = state.isPaused ? 'האינדוקס מושהה' : 'התוכנה בתהליך אינדוקס'; } + final pdfLabel = state.pdfPhase == PdfIndexingPhase.retry + ? 'ניסיון חוזר לחילוץ PDF' + : 'חילוץ PDF ברקע'; return WorkStatusItem( id: kIndexingWorkStatusId, title: 'אינדוקס ספרים', message: message, detail: state.pdfTotalPages != null && !state.isScanning - ? 'התקדמות: $processed/$total · חילוץ PDF ברקע: ' + ? 'התקדמות: $processed/$total · $pdfLabel: ' '${state.pdfPagesProcessed}/${state.pdfTotalPages} עמודים' : 'התקדמות: $processed/$total', progress: total > 0 ? (processed / total).clamp(0.0, 1.0) : null, diff --git a/lib/indexing/models/pdf_indexing_progress.dart b/lib/indexing/models/pdf_indexing_progress.dart new file mode 100644 index 0000000000..70a938a092 --- /dev/null +++ b/lib/indexing/models/pdf_indexing_progress.dart @@ -0,0 +1,19 @@ +import 'package:equatable/equatable.dart'; + +enum PdfIndexingPhase { extraction, retry } + +/// מספר העמודים שהטיפול בהם הסתיים בשלב הנוכחי, כולל עמודים ללא טקסט. +class PdfIndexingProgress extends Equatable { + const PdfIndexingProgress({ + required this.processed, + required this.total, + this.phase = PdfIndexingPhase.extraction, + }); + + final int processed; + final int total; + final PdfIndexingPhase phase; + + @override + List get props => [processed, total, phase]; +} diff --git a/lib/indexing/repository/indexing_repository.dart b/lib/indexing/repository/indexing_repository.dart index b8dab35099..05a89cf211 100644 --- a/lib/indexing/repository/indexing_repository.dart +++ b/lib/indexing/repository/indexing_repository.dart @@ -1,3 +1,4 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; import 'package:otzaria/indexing/models/indexing_resource_policy.dart'; import 'package:otzaria/indexing/services/indexing_resource_sampler.dart'; import 'package:otzaria/indexing/utils/indexing_yield.dart'; @@ -545,7 +546,7 @@ class IndexingRepository { bool includePdfBooks = true, void Function(int processed, int total)? onScanProgress, void Function(int total)? onWorkListReady, - void Function(int processed, int total)? onPdfProgress, + void Function(PdfIndexingProgress? progress)? onPdfProgress, void Function()? onActualIndexingStarted, required void Function(int processed, int total) onProgress, void Function()? onFinalizing, @@ -606,7 +607,7 @@ class IndexingRepository { bool includePdfBooks = true, void Function(int processed, int total)? onScanProgress, void Function(int total)? onWorkListReady, - void Function(int processed, int total)? onPdfProgress, + void Function(PdfIndexingProgress? progress)? onPdfProgress, void Function()? onActualIndexingStarted, required void Function(int processed, int total) onProgress, void Function()? onFinalizing, @@ -1542,7 +1543,7 @@ class IndexingRepository { required BookSourceHashes sourceHashes, void Function()? onActualIndexingStarted, Future? preExtracted, - void Function(int processed, int total)? onPdfProgress, + void Function(PdfIndexingProgress? progress)? onPdfProgress, }) async { // חילוץ מוקדם וישיר שומרים שגיאות בתוצאה; חסימת קריסה חלה גם על OCR. final extracted = @@ -1868,7 +1869,7 @@ class IndexingRepository { @visibleForTesting Future extractPdfPagesGuarded( PdfBook book, { - void Function(int processed, int total)? onProgress, + void Function(PdfIndexingProgress? progress)? onProgress, }) async { final stopwatch = Stopwatch()..start(); try { @@ -1895,7 +1896,7 @@ class IndexingRepository { droppedPages: 0, ); } finally { - onProgress?.call(0, 0); + onProgress?.call(null); } } @@ -1910,7 +1911,7 @@ class IndexingRepository { > _extractPdfPages( PdfBook book, { - void Function(int processed, int total)? onProgress, + void Function(PdfIndexingProgress? progress)? onProgress, }) async { const empty = ( pages: <({String reference, String text, int pageIndex})>[], @@ -1992,14 +1993,27 @@ class IndexingRepository { required Future Function(int pageIndex) loadPageText, required Future Function() beforeEachPage, Duration pageTimeout = const Duration(seconds: 5), - void Function(int processed, int total)? onProgress, + Duration Function()? progressElapsed, + void Function(PdfIndexingProgress? progress)? onProgress, }) async { - final progressClock = onProgress == null ? null : (Stopwatch()..start()); + final progressClock = onProgress == null || progressElapsed != null + ? null + : (Stopwatch()..start()); + var lastReport = Duration.zero; + var phase = PdfIndexingPhase.extraction; + var phaseTotal = pageCount; void report(int processed, {bool force = false}) { - if (progressClock != null && - (force || progressClock.elapsedMilliseconds >= 250)) { - onProgress!(processed, pageCount); - progressClock.reset(); + if (onProgress == null) return; + final elapsed = progressElapsed?.call() ?? progressClock!.elapsed; + if (force || elapsed - lastReport >= const Duration(milliseconds: 250)) { + onProgress( + PdfIndexingProgress( + processed: processed, + total: phaseTotal, + phase: phase, + ), + ); + lastReport = elapsed; } } @@ -2035,7 +2049,14 @@ class IndexingRepository { if (i + 1 < pageCount) report(i + 1); } + report(pageCount, force: true); var droppedPages = 0; + if (retryPages.isNotEmpty) { + phase = PdfIndexingPhase.retry; + phaseTotal = retryPages.length; + report(0, force: true); + } + var retried = 0; for (final i in retryPages) { if (!await beforeEachPage()) return null; final reusingPending = pending.containsKey(i); @@ -2049,8 +2070,10 @@ class IndexingRepository { } else { texts[i] = text; } + retried++; + if (retried < phaseTotal) report(retried); } - report(pageCount, force: true); + if (retryPages.isNotEmpty) report(retried, force: true); return (texts: texts, droppedPages: droppedPages); } diff --git a/test/indexing/bloc/indexing_bloc_test.dart b/test/indexing/bloc/indexing_bloc_test.dart index 0826429f03..c18d771785 100644 --- a/test/indexing/bloc/indexing_bloc_test.dart +++ b/test/indexing/bloc/indexing_bloc_test.dart @@ -1,3 +1,5 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; + import 'dart:async'; import 'package:bloc_test/bloc_test.dart'; @@ -71,7 +73,7 @@ void main() { final progress = bloc.stream.firstWhere( (state) => state is IndexingInProgress && state.pdfPagesProcessed == 23, ); - report(23, 120); + report(const PdfIndexingProgress(processed: 23, total: 120)); final displayed = await progress as IndexingInProgress; expect(displayed.pdfTotalPages, 120); expect(displayed.isCreatingIndex, isFalse); @@ -84,11 +86,46 @@ void main() { ); bloc.add(PauseIndexing()); expect((await paused as IndexingInProgress).pdfPagesProcessed, 23); + final retryState = bloc.stream.firstWhere( + (state) => + state is IndexingInProgress && + state.pdfPhase == PdfIndexingPhase.retry, + ); + report( + const PdfIndexingProgress( + processed: 2, + total: 5, + phase: PdfIndexingPhase.retry, + ), + ); + expect((await retryState as IndexingInProgress).pdfPagesProcessed, 2); + expect( + status.state.items[kIndexingWorkStatusId]?.detail, + contains('ניסיון חוזר לחילוץ PDF: 2/5'), + ); + bloc.add( + const UpdatePdfIndexingProgress( + -1, + PdfIndexingProgress( + processed: 4, + total: 5, + phase: PdfIndexingPhase.retry, + ), + ), + ); + await pumpEventQueue(); + expect((bloc.state as IndexingInProgress).pdfPagesProcessed, 2); final stopped = bloc.stream.firstWhere((state) => state is IndexingStopped); bloc.add(CancelIndexing()); await stopped; expect(status.state.items, isEmpty); - report(99, 120); + report( + const PdfIndexingProgress( + processed: 99, + total: 120, + phase: PdfIndexingPhase.retry, + ), + ); await pumpEventQueue(); expect(bloc.state, isA()); repository.pdfGate!.complete(); @@ -96,6 +133,57 @@ void main() { await bloc.close(); }); + test('null מנקה חיווי retry ואירוע מאוחר אינו חוזר בשלב האיחוד', () async { + final repository = _FakeIndexingRepository() + ..pdfGate = Completer() + ..finalizeGate = Completer(); + final bloc = _FakeIndexingBloc(repository); + final settled = Completer(); + bloc.add(StartIndexing(libraryWithBooks(), onSettled: settled.complete)); + await repository.pdfReady.future; + await pumpEventQueue(); + final report = repository.reportPdfProgress!; + final retry = bloc.stream.firstWhere( + (state) => + state is IndexingInProgress && + state.pdfPhase == PdfIndexingPhase.retry, + ); + report( + const PdfIndexingProgress( + processed: 1, + total: 3, + phase: PdfIndexingPhase.retry, + ), + ); + await retry; + final cleared = bloc.stream.firstWhere( + (state) => state is IndexingInProgress && state.pdfTotalPages == null, + ); + report(null); + expect( + (await cleared as IndexingInProgress).pdfPhase, + PdfIndexingPhase.extraction, + ); + final finalizing = bloc.stream.firstWhere( + (state) => state is IndexingInProgress && state.isFinalizing, + ); + repository.pdfGate!.complete(); + final finalizingState = await finalizing; + report( + const PdfIndexingProgress( + processed: 2, + total: 3, + phase: PdfIndexingPhase.retry, + ), + ); + await pumpEventQueue(); + expect(bloc.state, finalizingState); + expect((bloc.state as IndexingInProgress).pdfTotalPages, isNull); + repository.finalizeGate!.complete(); + await settled.future; + await bloc.close(); + }); + group('מקום פנוי בכונן האינדקס', () { const mb = 1024 * 1024; @@ -1397,7 +1485,7 @@ class _FakeIndexingRepository extends IndexingRepository { Completer? runGate; Completer? pdfGate; final pdfReady = Completer(); - void Function(int, int)? reportPdfProgress; + void Function(PdfIndexingProgress? progress)? reportPdfProgress; int dropOrphanedCalls = 0; final compactionRequests = []; int dropHiddenCalls = 0; @@ -1443,7 +1531,7 @@ class _FakeIndexingRepository extends IndexingRepository { bool includePdfBooks = true, void Function(int processed, int total)? onScanProgress, void Function(int total)? onWorkListReady, - void Function(int processed, int total)? onPdfProgress, + void Function(PdfIndexingProgress? progress)? onPdfProgress, void Function()? onActualIndexingStarted, required void Function(int processed, int total) onProgress, void Function()? onFinalizing, diff --git a/test/indexing/indexing_work_status_test.dart b/test/indexing/indexing_work_status_test.dart index 87f2a432a8..f7302e14eb 100644 --- a/test/indexing/indexing_work_status_test.dart +++ b/test/indexing/indexing_work_status_test.dart @@ -1,9 +1,25 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/indexing/bloc/indexing_state.dart'; import 'package:otzaria/indexing/indexing_work_status.dart'; void main() { group('indexingWorkStatusItem', () { + test('שלב החזרה מציג מכנה של העמודים הממתינים בלבד', () { + final item = indexingWorkStatusItem( + const IndexingInProgress( + booksProcessed: 7, + totalBooks: 12, + pdfPagesProcessed: 2, + pdfTotalPages: 5, + pdfPhase: PdfIndexingPhase.retry, + ), + onTogglePause: () {}, + onToggleEconomy: () {}, + ); + expect(item.detail, 'התקדמות: 7/12 · ניסיון חוזר לחילוץ PDF: 2/5 עמודים'); + expect(item.progress, closeTo(7 / 12, 0.001)); + }); test('חיווי PDF מציג עמודים בלי להחליף את התקדמות הספרים', () { final item = indexingWorkStatusItem( const IndexingInProgress( diff --git a/test/indexing/repository/indexing_repository_test.dart b/test/indexing/repository/indexing_repository_test.dart index 3fc9b0e9b8..340e29ecc9 100644 --- a/test/indexing/repository/indexing_repository_test.dart +++ b/test/indexing/repository/indexing_repository_test.dart @@ -1,3 +1,4 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; import 'package:otzaria/data/book_identity.dart'; import 'dart:async'; @@ -5403,7 +5404,7 @@ class _FakeExtractionRepository extends IndexingRepository { @override Future extractPdfPagesGuarded( PdfBook book, { - void Function(int processed, int total)? onProgress, + void Function(PdfIndexingProgress? progress)? onProgress, }) async { extractedTitles.add(book.title); _activeExtractions++; @@ -5454,7 +5455,7 @@ class _CanaryExtractionRepository extends _FakeExtractionRepository { @override Future extractPdfPagesGuarded( PdfBook book, { - void Function(int processed, int total)? onProgress, + void Function(PdfIndexingProgress? progress)? onProgress, }) { if (IndexingCrashCanary.current?.begin(book.path) == false) { throw const IndexingCrashedBefore(); @@ -5471,7 +5472,7 @@ class _GatedPdfExtractionRepository extends _FakeExtractionRepository { @override Future extractPdfPagesGuarded( PdfBook book, { - void Function(int processed, int total)? onProgress, + void Function(PdfIndexingProgress? progress)? onProgress, }) async { await extractionGate; return super.extractPdfPagesGuarded(book, onProgress: onProgress); diff --git a/test/indexing/repository/pdf_text_timeout_test.dart b/test/indexing/repository/pdf_text_timeout_test.dart index 15ab17782b..10208d3096 100644 --- a/test/indexing/repository/pdf_text_timeout_test.dart +++ b/test/indexing/repository/pdf_text_timeout_test.dart @@ -1,3 +1,5 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; + import 'dart:async'; import 'package:fake_async/fake_async.dart'; @@ -5,13 +7,143 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:otzaria/indexing/repository/indexing_repository.dart'; void main() { + test('חיווי מפריד בין סריקת עמודים לניסיונות חוזרים ומגביל כל שלב', () { + fakeAsync((clock) { + final reports = []; + final attempts = {}; + ({Map texts, int droppedPages})? result; + IndexingRepository.extractPageTextsWithRetry( + pageCount: 8, + loadPageText: (index) async { + final attempt = attempts.update( + index, + (n) => n + 1, + ifAbsent: () => 1, + ); + await Future.delayed(const Duration(milliseconds: 100)); + return attempt == 1 ? null : 'עמוד $index'; + }, + beforeEachPage: () async => true, + progressElapsed: () => clock.elapsed, + onProgress: (value) => reports.add(value!), + ).then((value) => result = value); + clock.elapse(const Duration(seconds: 2)); + expect(result!.texts.length, 8); + expect(result!.droppedPages, 0); + expect(attempts.values, everyElement(2)); + for (final phase in PdfIndexingPhase.values) { + final series = reports.where((r) => r.phase == phase).toList(); + expect(series.map((r) => r.processed), [0, 3, 6, 8]); + expect(series.map((r) => r.total), everyElement(8)); + } + }); + }); + + test('מאה timeouts מתקדמים בשני שלבים בלי להכפיל חילוץ', () { + fakeAsync((clock) { + final pages = List.generate(100, (_) => Completer()); + final calls = []; + final reports = []; + ({Map texts, int droppedPages})? result; + IndexingRepository.extractPageTextsWithRetry( + pageCount: pages.length, + loadPageText: (index) { + calls.add(index); + return pages[index].future; + }, + beforeEachPage: () async => true, + progressElapsed: () => clock.elapsed, + onProgress: (value) => reports.add(value!), + ).then((value) => result = value); + clock.elapse(const Duration(seconds: 501)); + expect(reports.last.phase, PdfIndexingPhase.retry); + expect(reports.last.processed, 0); + clock.elapse(const Duration(seconds: 500)); + expect(result!.droppedPages, 100); + expect(calls, List.generate(100, (index) => index)); + for (final phase in PdfIndexingPhase.values) { + final series = reports.where((r) => r.phase == phase); + expect(series.map((r) => r.processed), List.generate(101, (i) => i)); + expect(series.map((r) => r.total), everyElement(100)); + } + for (final page in pages) { + page.complete(null); + } + clock.flushMicrotasks(); + }); + }); + + test('retry סופר רק תת קבוצה וסופר null מאוחר פעם אחת', () { + fakeAsync((clock) { + final first = Completer(); + final calls = {}; + final reports = []; + ({Map texts, int droppedPages})? result; + Timer(const Duration(seconds: 6), () => first.complete(null)); + IndexingRepository.extractPageTextsWithRetry( + pageCount: 3, + loadPageText: (index) { + final attempt = calls.update(index, (n) => n + 1, ifAbsent: () => 1); + if (index == 0 && attempt == 1) return first.future; + if (index == 1) { + return Future.delayed(const Duration(seconds: 2), () => 'שני'); + } + return Future.value('עמוד $index'); + }, + beforeEachPage: () async => true, + progressElapsed: () => clock.elapsed, + onProgress: (value) => reports.add(value!), + ).then((value) => result = value); + clock.elapse(const Duration(seconds: 8)); + expect(result!.texts.length, 3); + expect(result!.droppedPages, 0); + expect(calls, {0: 2, 1: 1, 2: 1}); + final retry = reports.where((r) => r.phase == PdfIndexingPhase.retry); + expect(retry.map((r) => r.processed), [0, 1]); + expect(retry.map((r) => r.total), everyElement(1)); + }); + }); + + test('ביטול בתחילת retry אינו מציג השלמה שגויה', () { + fakeAsync((clock) { + var cancelled = false; + final reports = []; + var completed = false; + ({Map texts, int droppedPages})? result; + IndexingRepository.extractPageTextsWithRetry( + pageCount: 3, + loadPageText: (_) async => null, + beforeEachPage: () async => !cancelled, + progressElapsed: () => clock.elapsed, + onProgress: (value) { + reports.add(value!); + if (value.phase == PdfIndexingPhase.retry) cancelled = true; + }, + ).then((value) { + result = value; + completed = true; + }); + clock.flushMicrotasks(); + expect(completed, isTrue); + expect(result, isNull); + expect( + reports.last, + const PdfIndexingProgress( + processed: 0, + total: 3, + phase: PdfIndexingPhase.retry, + ), + ); + }); + }); + test('חיווי עמודים כולל התחלה וסיום בלי אירוע לכל עמוד', () async { final progress = <(int, int)>[]; final result = await IndexingRepository.extractPageTextsWithRetry( pageCount: 100, loadPageText: (index) async => 'עמוד $index', beforeEachPage: () async => true, - onProgress: (processed, total) => progress.add((processed, total)), + onProgress: (value) => progress.add((value!.processed, value.total)), ); expect(result!.texts.length, 100); expect(progress.first, (0, 100)); diff --git a/test/support/indexing_progress_capture_test.dart b/test/support/indexing_progress_capture_test.dart index 5b129aa4bd..67180ab640 100644 --- a/test/support/indexing_progress_capture_test.dart +++ b/test/support/indexing_progress_capture_test.dart @@ -1,3 +1,5 @@ +import 'package:otzaria/indexing/models/pdf_indexing_progress.dart'; + import 'dart:io'; import 'dart:ui' as ui; @@ -44,14 +46,27 @@ void main() { ? AppThemeData.light(scheme, compactMenuMode: compact) : AppThemeData.dark(scheme, compactMenuMode: compact); - for (final after in [false, true]) { + for (final capture in ['before', 'after', 'retry']) { + final after = capture != 'before'; + final retry = capture == 'retry'; cubit.upsert( indexingWorkStatusItem( IndexingInProgress( booksProcessed: 7, totalBooks: 12, - pdfPagesProcessed: after ? 23 : null, - pdfTotalPages: after ? 120 : null, + pdfPagesProcessed: retry + ? 2 + : after + ? 23 + : null, + pdfTotalPages: retry + ? 5 + : after + ? 120 + : null, + pdfPhase: retry + ? PdfIndexingPhase.retry + : PdfIndexingPhase.extraction, ), onTogglePause: () {}, onToggleEconomy: () {}, @@ -80,7 +95,9 @@ void main() { expect(find.text('אינדוקס ספרים'), findsOneWidget); expect(find.text('השהה'), findsOneWidget); expect( - find.textContaining('חילוץ PDF ברקע'), + find.textContaining( + retry ? 'ניסיון חוזר לחילוץ PDF' : 'חילוץ PDF ברקע', + ), after ? findsOneWidget : findsNothing, ); expect( @@ -91,7 +108,7 @@ void main() { boundaryKey.currentContext!.findRenderObject()! as RenderRepaintBoundary; final name = - '${after ? 'after' : 'before'}-${compact ? 'compact' : 'desktop'}-${brightness.name}.png'; + '$capture-${compact ? 'compact' : 'desktop'}-${brightness.name}.png'; await tester.runAsync(() async { final image = await boundary.toImage(); try { From c5b82bee4cdc1e53295a8603eb85a8b8bc73ec2a Mon Sep 17 00:00:00 2001 From: ypl <7353755@gmail.com> Date: Wed, 2 Dec 2026 03:07:53 +0200 Subject: [PATCH 11/11] =?UTF-8?q?=D7=90=D7=99=D7=A0=D7=93=D7=95=D7=A7?= =?UTF-8?q?=D7=A1=20PDF:=20=D7=A1=D7=A0=D7=9F=20=D7=93=D7=99=D7=95=D7=95?= =?UTF-8?q?=D7=97=D7=99=D7=9D=20=D7=90=D7=97=D7=A8=D7=99=20=D7=91=D7=99?= =?UTF-8?q?=D7=98=D7=95=D7=9C=20=D7=95=D7=9E=D7=93=D7=95=D7=93=20=D7=97?= =?UTF-8?q?=D7=99=D7=95=D7=95=D7=99=20=D7=9C=D7=9C=D7=90=20=D7=94=D7=A7?= =?UTF-8?q?=D7=A6=D7=90=D7=95=D7=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/indexing/bloc/indexing_bloc.dart | 1 + .../repository/indexing_repository.dart | 11 ++-- test/indexing/bloc/indexing_bloc_test.dart | 65 ++++++++++++++++++- 3 files changed, 72 insertions(+), 5 deletions(-) diff --git a/lib/indexing/bloc/indexing_bloc.dart b/lib/indexing/bloc/indexing_bloc.dart index 9783205ba4..90be4da774 100644 --- a/lib/indexing/bloc/indexing_bloc.dart +++ b/lib/indexing/bloc/indexing_bloc.dart @@ -574,6 +574,7 @@ class IndexingBloc extends Bloc { return; } final progress = event.progress; + if (progress != null && !_repository.isIndexing()) return; _pdfTotalPages = progress != null && progress.total > 0 ? progress.total : null; diff --git a/lib/indexing/repository/indexing_repository.dart b/lib/indexing/repository/indexing_repository.dart index 05a89cf211..f1ae20c5b5 100644 --- a/lib/indexing/repository/indexing_repository.dart +++ b/lib/indexing/repository/indexing_repository.dart @@ -1999,13 +1999,16 @@ class IndexingRepository { final progressClock = onProgress == null || progressElapsed != null ? null : (Stopwatch()..start()); - var lastReport = Duration.zero; + const progressIntervalMicros = 250 * Duration.microsecondsPerMillisecond; + var lastReportMicros = 0; var phase = PdfIndexingPhase.extraction; var phaseTotal = pageCount; void report(int processed, {bool force = false}) { if (onProgress == null) return; - final elapsed = progressElapsed?.call() ?? progressClock!.elapsed; - if (force || elapsed - lastReport >= const Duration(milliseconds: 250)) { + final elapsedMicros = + progressElapsed?.call().inMicroseconds ?? + progressClock!.elapsedMicroseconds; + if (force || elapsedMicros - lastReportMicros >= progressIntervalMicros) { onProgress( PdfIndexingProgress( processed: processed, @@ -2013,7 +2016,7 @@ class IndexingRepository { phase: phase, ), ); - lastReport = elapsed; + lastReportMicros = elapsedMicros; } } diff --git a/test/indexing/bloc/indexing_bloc_test.dart b/test/indexing/bloc/indexing_bloc_test.dart index c18d771785..9e863656da 100644 --- a/test/indexing/bloc/indexing_bloc_test.dart +++ b/test/indexing/bloc/indexing_bloc_test.dart @@ -115,6 +115,22 @@ void main() { ); await pumpEventQueue(); expect((bloc.state as IndexingInProgress).pdfPagesProcessed, 2); + + repository.indexingActive = false; + report( + const PdfIndexingProgress( + processed: 5, + total: 5, + phase: PdfIndexingPhase.retry, + ), + ); + await pumpEventQueue(); + expect((bloc.state as IndexingInProgress).pdfPagesProcessed, 2); + + report(null); + await pumpEventQueue(); + expect((bloc.state as IndexingInProgress).pdfTotalPages, isNull); + final stopped = bloc.stream.firstWhere((state) => state is IndexingStopped); bloc.add(CancelIndexing()); await stopped; @@ -133,6 +149,51 @@ void main() { await bloc.close(); }); + test('דיווח ואיפוס מחילוץ ישן אינם מחליפים חיווי של ריצה חדשה', () async { + final firstGate = Completer(); + final secondGate = Completer(); + final repository = _FakeIndexingRepository()..pdfGate = firstGate; + final bloc = _FakeIndexingBloc(repository); + final stopped = bloc.stream.firstWhere((state) => state is IndexingStopped); + bloc.add(StartIndexing(libraryWithBooks())); + await repository.pdfReady.future; + final oldReport = repository.reportPdfProgress!; + bloc.add(CancelIndexing()); + await stopped; + + repository.pdfGate = secondGate; + final secondStarted = bloc.stream.firstWhere( + (state) => state is IndexingInProgress && state.totalBooks == 2, + ); + final secondSettled = Completer(); + bloc.add( + StartIndexing(libraryWithBooks(2), onSettled: secondSettled.complete), + ); + firstGate.complete(); + await secondStarted; + final freshProgress = bloc.stream.firstWhere( + (state) => state is IndexingInProgress && state.pdfPagesProcessed == 1, + ); + repository.reportPdfProgress!( + const PdfIndexingProgress(processed: 1, total: 8), + ); + final beforeLateEvents = await freshProgress; + oldReport(null); + oldReport( + const PdfIndexingProgress( + processed: 5, + total: 5, + phase: PdfIndexingPhase.retry, + ), + ); + await pumpEventQueue(); + expect(bloc.state, beforeLateEvents); + + secondGate.complete(); + await secondSettled.future; + await bloc.close(); + }); + test('null מנקה חיווי retry ואירוע מאוחר אינו חוזר בשלב האיחוד', () async { final repository = _FakeIndexingRepository() ..pdfGate = Completer() @@ -1636,8 +1697,10 @@ class _FakeIndexingRepository extends IndexingRepository { library.getIndexableBooks().any((book) => !isBookIndexed(book)); } + bool indexingActive = true; + @override - bool isIndexing() => true; + bool isIndexing() => indexingActive; @override void cancelIndexing() {