发布

  • Remove dead WebApp.activationCodes: List<String> field

    frostbyte_neo 发布于 2026-06-01 02:29:55 +00:00 | 761 次提交 在此版本后已推送到 main

    WebApp.activationCodes: List was a never-read column on the host
    side. The activator path that built the runtime list went through
    WebApp.activationCodeList (structured ActivationCode entries) and
    ApkConfig.activation.codes; nothing in app/ ever wrote to or read from
    the plain List mirror. It survived in the data class and the
    Room schema as a ghost field that always read empty and always wrote
    emptyList().

    Field + column + writers + tests, all in one go:

    • WebApp.kt: drop the field.
    • EditState.kt: drop the UI-state mirror.
    • MainViewModel.kt: drop 8 activationCodes = emptyList() writers.
    • WebAppDraftBuilder.kt: drop 2 more (different file, easy to miss).
    • AppDatabase: bump version 36 -> 37 and add MIGRATION_36_37 that uses
      the existing rebuildWebAppsTable helper to rebuild the table without
      the column. MIGRATION_35_36 stays untouched (its CREATE still has
      activationCodes) so v35 -> v36 transitions keep their data; v36 -> 37
      then drops it. Schema export committed alongside the migration.
    • WebAppModelTest / WebAppModelExtendedTest: drop the dead
      activationCodes = listOf(...) test args and rename the affected
      tests (the contrast with an 'old' list no longer applies).
    • AboutScreen.kt: add the missing getValue/setValue imports for the
      Compose state-delegation var x by remember { mutableStateOf(...) },
      without which the file no longer compiles after a parallel edit
      dropped the redundant explicit getValue/setValue aliases.
    • ApkConfigJsonFactory.kt: the 'encrypted stub keeps only public
      placeholder fields' test (already in flight) now correctly reflects
      the stub that the factory emits after this removal.

    Surviving activationCodes references are all alive and typed
    correctly: AppModifierEditState.activationCodes / AppModifyPayload /
    InstalledAppInfo all hold List; ShellConfig holds
    List that flows from ApkConfig.activation.codes at build time
    and is consumed by verifyActivationCode at runtime. AppModifierScreen
    reads editState.activationCodes — that is the AppModifierEditState
    field, not the dead one.

    :app:testDebugUnitTest: 31/31 tests touching activation codes green
    (WebAppModelTest 6/6, WebAppModelExtendedTest 17/17, the WebApp-side
    of ApkConfigJsonFactoryTest 8/8 including the stub test). 5 unrelated
    failures (ApkExportPreflightTest, DataBackupManagerTest,
    NodeDependencyManagerTest, PythonDependencyManagerTest,
    WordPressPhpRuntimeTest) are pre-existing and not in this diff.
    :app:assembleDebug: BUILD SUCCESSFUL.

    下载附件