Skip to content

Commit 148046d

Browse files
fix(android): post-merge cleanup from the fork-resync integration
- ConfigStore.toJson(): drop a duplicate `fronting_groups` put left behind when therealaleph#1033 (fronting groups) + therealaleph#1057 (extras passthrough) + therealaleph#1189 (draft-drop filter) were squash-merged in sequence. The later filtered put was being overwritten by the older unfiltered one, breaking the ConfigStoreFrontingGroupsTest expectation that draft groups never reach disk. - ProfileStoreTest.applyProfile_*_returns_partial: the snapshot config was missing a deployment ID, so validateRuntimeShape rejected it as 'apps_script mode requires script_id' before the test's injected write failure could be exercised. Pre-existing bug in therealaleph#1057's tests; only surfaced now that we run the full suite on the integrated branch.
1 parent 5d20088 commit 148046d

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎android/app/src/main/java/com/therealaleph/mhrv/ConfigStore.kt‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -410,18 +410,6 @@ data class MhrvConfig(
410410
UiLang.EN -> "en"
411411
})
412412

413-
if (frontingGroups.isNotEmpty()) {
414-
put("fronting_groups", JSONArray().apply {
415-
for (g in frontingGroups) {
416-
put(JSONObject().apply {
417-
put("name", g.name)
418-
put("ip", g.ip)
419-
put("sni", g.sni)
420-
put("domains", JSONArray().apply { g.domains.forEach { put(it) } })
421-
})
422-
}
423-
})
424-
}
425413
// Splice back any keys this build doesn't model (so they
426414
// survive a load → edit → save round-trip and reach the
427415
// native runtime, which IS the source of truth for them).

‎android/app/src/test/java/com/therealaleph/mhrv/ProfileStoreTest.kt‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,20 @@ class ProfileStoreTest {
627627
*/
628628
@Test
629629
fun applyProfile_profiles_write_failure_returns_partial() {
630-
ProfileStore.upsert(ctx, "home", MhrvConfig(authKey = "homekey"))
631-
ProfileStore.upsert(ctx, "other", MhrvConfig(authKey = "otherkey"))
630+
// Snapshots must pass `validateRuntimeShape` — apps_script
631+
// mode (the default) requires a deployment ID + auth_key,
632+
// otherwise applyProfile short-circuits with Failed before
633+
// ever reaching the step-1 write we're trying to verify here.
634+
ProfileStore.upsert(
635+
ctx,
636+
"home",
637+
MhrvConfig(appsScriptUrls = listOf("HOME_ID"), authKey = "homekey"),
638+
)
639+
ProfileStore.upsert(
640+
ctx,
641+
"other",
642+
MhrvConfig(appsScriptUrls = listOf("OTHER_ID"), authKey = "otherkey"),
643+
)
632644
val profilesBefore = profilesFile.readText()
633645
assertEquals("other", ProfileStore.load(ctx).active)
634646

0 commit comments

Comments
 (0)