Modern Apps git

← Modern-Apps.git

code: batch unit tests - quarantine tree-sitter, git and EditorPrefs classes

Commit
5d71d6878481f944a9ab11f6eec4d6240e13e459
Author
Vayun Mathur <[email protected]>
When
2026-11-21 22:00 UTC (14 days ago)
Parents
e0b1cf3
Split audit: 8 native loaders (libcode_ts tree-sitter incl.
UI paths through rememberTreeSitterSpans, JGit real-repo
tests) and 24 polluters (EditorPrefs is the module's only
DataStore owner; EditorViewModel launches ~20 collectors on
it; the token-sealing tests swap a process-wide static)
quarantined at forkEvery=1; 29 batch at 20.

632/632 green both ways, 75s -> 65s with no build cache - the
ceiling is honest (288 tests legitimately stay per-class).
New code classes touching tree-sitter/git natives or
EditorPrefs/EditorViewModel must join the lists.

Diff

code/build.gradle.kts
diff --git a/code/build.gradle.kts b/code/build.gradle.ktsindex 52e9bda338..b6155c92ea 100644--- a/code/build.gradle.kts+++ b/code/build.gradle.kts@@ -28,6 +28,76 @@ androidComponents { } rustNativeLib("code_ts", "code") +// Only the classes below actually load a native library: they execute a+// path that touches TreeSitterNative (libcode_ts via NativeLoader) โ€”+// directly, through treeSitterColorSpans, or through CodeEditor /+// CodeEditorView's rememberTreeSitterSpans when a tabbed EditorScreen /+// EditorBody / SplitEditors composition runs โ€” or they drive GitRepo+// (JGit) against real on-disk repositories. TreeSitterNativeTest and+// EditorChromeLogicTest are plain JVM tests, so mixing them in one JVM+// with the Robolectric sandbox loaders binds libcode_ts to two+// classloaders. Quarantine the loaders and the shared-JVM polluters+// below into testDevUnitTestNative (forkEvery = 1); the remaining+// classes batch 20-per-JVM in testDevUnitTest, which depends on the+// quarantine task so the usual invocation still runs everything.+rustNativeTests {+    nativeClasses.addAll(+        listOf(+            "com.vayunmathur.code.ui.CodeEditorUiTest",+            "com.vayunmathur.code.ui.EditorChromeLogicTest",+            "com.vayunmathur.code.ui.EditorScreenUiTest",+            "com.vayunmathur.code.ui.Wave2TreeScreenUiTest",+            "com.vayunmathur.code.util.GitLocalRemoteTest",+            "com.vayunmathur.code.util.GitPushTest",+            "com.vayunmathur.code.util.GitRepoTest",+            "com.vayunmathur.code.util.TreeSitterNativeTest",+        )+    )+    // Shared-JVM polluters keep forkEvery = 1 in the same companion task:+    // EditorPrefs is the module's only DataStore owner (the top-level+    // preferencesDataStore delegate for "code_editor"), and+    // EditorViewModel init launches ~20 viewModelScope collectors that+    // read its flows (several setters then persist through it), never+    // cleared when the test never calls onCleared; EditorPrefs also+    // holds the process-wide sealerForTest static that CodeTokenSealing /+    // EditorPrefs tests swap. Persisted DataStore state (folder, session+    // tabs, snippets, git credentials โ€” SessionRestoreTest even cleans+    // up explicitly "so later VMs in this process start empty") leaks+    // into classes expecting defaults. Audit rule: any test+    // instantiating EditorViewModel (or launching a screen that builds+    // one), or using EditorPrefs directly, belongs here. Several of+    // these UI classes also render the editor and would load+    // libcode_ts anyway. All other classes batch.+    isolatedClasses.addAll(+        listOf(+            "com.vayunmathur.code.data.CodeTokenSealingTest",+            "com.vayunmathur.code.ui.EditorPagesUiTest",+            "com.vayunmathur.code.ui.EditorScreenDialogsUiTest",+            "com.vayunmathur.code.ui.ExperimentalAndPagesUiTest",+            "com.vayunmathur.code.ui.GitPageUiTest",+            "com.vayunmathur.code.ui.MainAndExpandedUiTest",+            "com.vayunmathur.code.ui.MoreInteractionsUiTest",+            "com.vayunmathur.code.ui.PreviewAndMinimapBehaviourTest",+            "com.vayunmathur.code.ui.RepoAndBodyUiTest",+            "com.vayunmathur.code.ui.SearchPreviewUiTest",+            "com.vayunmathur.code.ui.Wave2EditorFindUiTest",+            "com.vayunmathur.code.ui.Wave2GitToolbarUiTest",+            "com.vayunmathur.code.ui.Wave2MoreUiTest",+            "com.vayunmathur.code.ui.Wave3FinalPushTest",+            "com.vayunmathur.code.util.EditorActionsTest",+            "com.vayunmathur.code.util.EditorFileTreeOpsBehaviourTest",+            "com.vayunmathur.code.util.EditorFileTreeOpsTest",+            "com.vayunmathur.code.util.EditorPrefsTest",+            "com.vayunmathur.code.util.EditorSearchOpsTest",+            "com.vayunmathur.code.util.EditorViewModelTest",+            "com.vayunmathur.code.util.LoadFailureTest",+            "com.vayunmathur.code.util.SessionRestoreTest",+            "com.vayunmathur.code.util.VmOpsTest",+            "com.vayunmathur.code.util.Wave2VmActionsTest",+        )+    )+}+ dependencies {     implementation(libs.androidx.datastore.preferences)     implementation(libs.jgit)