functionsOutOfSyncFromMeta function
Pure decision function, exposed for unit tests.
Given the deployed schema's version and the value of
_schema_meta.functions_hash on the user's project, returns true when
the Settings banner should prompt the user to redeploy.
Semantics:
version < 59(or unknown): returnfalse. The schema is not yet at the version that adds thefunctions_hashcolumn; the incremental migration runner will catch it up shortly, and a banner at this point would trigger a dialog that immediately fails when it tries to write to a non-existent column.version >= 59anddeployedHashisnullor empty: returntrue. This is the legacy-BYO case — the user bootstrapped before this feature shipped, migration 059 has just added the column, but the hash has never been written because the user has never deployed Edge Functions through the new dialog.version >= 59anddeployedHash != bundledHash: returntrue. Stale deployment from a previous app release.version >= 59anddeployedHash == bundledHash: returnfalse.
Implementation
bool functionsOutOfSyncFromMeta({
required int? schemaVersion,
required String? deployedHash,
required String bundledHash,
}) {
if (schemaVersion == null || schemaVersion < _functionsHashMinVersion) {
return false;
}
if (deployedHash == null || deployedHash.isEmpty) return true;
return deployedHash != bundledHash;
}