Skip to content

Commit d00301e

Browse files
ldanilekConvex, Inc.
authored and
Convex, Inc.
committed
SerializedComponentDiff::index_diff is optional (#29976)
there are some audit log documents where this field is missing. we could migrate them to have the field, but it's easier to accept that they might not exist and handle it. Should fix db-verifier and also dashboard for these instances. GitOrigin-RevId: 5dbd45b2b4e620a14e3cc9c3b5939dd0cb1416d0
1 parent 15b30a1 commit d00301e

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

crates/model/src/components/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ pub struct SerializedComponentDiff {
852852
module_diff: ModuleDiff,
853853
udf_config_diff: Option<UdfServerVersionDiff>,
854854
cron_diff: CronDiff,
855-
index_diff: SerializedIndexDiff,
855+
index_diff: Option<SerializedIndexDiff>,
856856
schema_diff: Option<SerializedSchemaDiff>,
857857
}
858858

@@ -891,7 +891,7 @@ impl TryFrom<ComponentDiff> for SerializedComponentDiff {
891891
module_diff: value.module_diff,
892892
udf_config_diff: value.udf_config_diff,
893893
cron_diff: value.cron_diff,
894-
index_diff: value.index_diff.try_into()?,
894+
index_diff: Some(value.index_diff.try_into()?),
895895
schema_diff: value.schema_diff.map(|diff| diff.try_into()).transpose()?,
896896
})
897897
}
@@ -906,7 +906,10 @@ impl TryFrom<SerializedComponentDiff> for ComponentDiff {
906906
module_diff: value.module_diff,
907907
udf_config_diff: value.udf_config_diff,
908908
cron_diff: value.cron_diff,
909-
index_diff: value.index_diff.try_into()?,
909+
index_diff: match value.index_diff {
910+
Some(index_diff) => index_diff.try_into()?,
911+
None => AuditLogIndexDiff::default(),
912+
},
910913
schema_diff: value.schema_diff.map(|diff| diff.try_into()).transpose()?,
911914
})
912915
}

crates/model/src/deployment_audit_log/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub static DEPLOYMENT_AUDIT_LOG_TABLE: LazyLock<TableName> = LazyLock::new(|| {
6565
.expect("Invalid deployment audit log table")
6666
});
6767

68-
#[derive(Debug, Clone, PartialEq)]
68+
#[derive(Debug, Clone, PartialEq, Default)]
6969
#[cfg_attr(any(test, feature = "testing"), derive(proptest_derive::Arbitrary))]
7070
pub struct AuditLogIndexDiff {
7171
#[cfg_attr(

npm-packages/convex/src/cli/lib/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ function printDiff(
419419

420420
// Print out index diffs for the root component.
421421
let rootDiff = componentDiffs[""];
422-
if (rootDiff) {
422+
if (rootDiff && rootDiff.indexDiff) {
423423
if (rootDiff.indexDiff.removed_indexes.length > 0) {
424424
let msg = `${opts.dryRun ? "Would delete" : "Deleted"} table indexes:\n`;
425425
for (let i = 0; i < rootDiff.indexDiff.removed_indexes.length; i++) {

npm-packages/system-udfs/convex/tableDefs/deploymentAuditLogTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const componentDiff = v.object({
129129
v.literal("remount"),
130130
),
131131
}),
132-
indexDiff: indexDiff,
132+
indexDiff: v.optional(indexDiff),
133133
udfConfigDiff: serverVersion,
134134
moduleDiff: moduleDiff,
135135
cronDiff: cronDiffType,

0 commit comments

Comments
 (0)