Skip to content

Commit 1128235

Browse files
committed
fix(catalog): add allow_unknown_fields to all persisted catalog types
zerompk 0.5 in strict map mode rejects unknown keys by default, which breaks rolling upgrades where a newer node writes a field that an older reader does not yet recognise. Adding allow_unknown_fields to every stored catalog struct and event-plane definition type restores the forward-compatible behaviour that the previous zerompk version provided implicitly. Affected types: StoredUser, StoredApiKey, StoredAuditEntry, StoredAuthUser, StoredIndex, StoredCollection, FieldDefinition, StoredContinuousAggregate, DatabaseDescriptor, ParentCloneRef, StoredFunction, StoredProcedure, StoredScope, StoredSequence, StoredTrigger, L2CleanupEntry, LockoutEntry, StoredMaterializedView, StoredOidcProvider, StoredOrg, ChangeStreamDef, ScheduleDef.
1 parent e35f2cd commit 1128235

17 files changed

Lines changed: 26 additions & 25 deletions

nodedb/src/control/security/catalog/auth_types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
/// Serializable user record for redb storage.
66
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
7-
#[msgpack(map)]
7+
#[msgpack(map, allow_unknown_fields)]
88
pub struct StoredUser {
99
pub user_id: u64,
1010
pub username: String,
@@ -49,7 +49,7 @@ pub struct StoredUser {
4949

5050
/// Serializable API key record for redb storage.
5151
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
52-
#[msgpack(map)]
52+
#[msgpack(map, allow_unknown_fields)]
5353
pub struct StoredApiKey {
5454
/// Unique key identifier (used as prefix in the token).
5555
pub key_id: String,
@@ -87,7 +87,7 @@ pub struct StoredTenant {
8787

8888
/// Serializable audit entry for redb storage.
8989
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
90-
#[msgpack(map)]
90+
#[msgpack(map, allow_unknown_fields)]
9191
pub struct StoredAuditEntry {
9292
pub seq: u64,
9393
pub timestamp_us: u64,
@@ -179,7 +179,7 @@ pub struct StoredBlacklistEntry {
179179

180180
/// Serializable JIT-provisioned auth user record for redb storage.
181181
#[derive(Debug, Clone, zerompk::ToMessagePack, zerompk::FromMessagePack)]
182-
#[msgpack(map)]
182+
#[msgpack(map, allow_unknown_fields)]
183183
pub struct StoredAuthUser {
184184
/// Unique identifier (from JWT `sub` or `user_id` claim).
185185
pub id: String,

nodedb/src/control/security/catalog/collection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub enum IndexBuildState {
3232
/// recovery, descriptor-lease invalidation, and DROP cascade all ride the
3333
/// existing collection-commit pipeline.
3434
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
35-
#[msgpack(map)]
35+
#[msgpack(map, allow_unknown_fields)]
3636
pub struct StoredIndex {
3737
/// Index identifier, unique per tenant.
3838
pub name: String,
@@ -59,7 +59,7 @@ pub struct StoredIndex {
5959

6060
/// Serializable collection metadata for redb storage.
6161
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
62-
#[msgpack(map)]
62+
#[msgpack(map, allow_unknown_fields)]
6363
pub struct StoredCollection {
6464
pub tenant_id: u64,
6565
pub name: String,

nodedb/src/control/security/catalog/collection_constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::bridge::expr_eval::SqlExpr;
1515

1616
/// Extended field definition supporting DEFAULT, VALUE, ASSERT, and TYPE constraints.
1717
#[derive(Debug, Clone, Serialize, Deserialize, ToMessagePack, FromMessagePack)]
18-
#[msgpack(map)]
18+
#[msgpack(map, allow_unknown_fields)]
1919
pub struct FieldDefinition {
2020
pub name: String,
2121
/// Type constraint: "int", "float", "string", etc. Empty = any.

nodedb/src/control/security/catalog/continuous_aggregate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use nodedb_types::Hlc;
1717
/// Data Plane's struct layout (the runtime type carries
1818
/// SIMD/quantization tuning that has no place in the catalog).
1919
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
20-
#[msgpack(map)]
20+
#[msgpack(map, allow_unknown_fields)]
2121
pub struct StoredContinuousAggregate {
2222
pub tenant_id: u64,
2323
pub name: String,

nodedb/src/control/security/catalog/database_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub enum DatabaseStatus {
4242
serde::Serialize,
4343
serde::Deserialize,
4444
)]
45-
#[msgpack(map)]
45+
#[msgpack(map, allow_unknown_fields)]
4646
pub struct DatabaseDescriptor {
4747
pub id: DatabaseId,
4848
/// Human-readable name. Mutable via `ALTER DATABASE RENAME`.
@@ -90,7 +90,7 @@ pub struct DatabaseDescriptor {
9090
serde::Serialize,
9191
serde::Deserialize,
9292
)]
93-
#[msgpack(map)]
93+
#[msgpack(map, allow_unknown_fields)]
9494
pub struct ParentCloneRef {
9595
pub source_db_id: DatabaseId,
9696
/// WAL LSN at which the clone was taken (the `AS OF` point).

nodedb/src/control/security/catalog/function_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl FunctionLanguage {
9797

9898
/// Serializable user-defined function record for redb storage.
9999
#[derive(Debug, Clone, zerompk::ToMessagePack, zerompk::FromMessagePack)]
100-
#[msgpack(map)]
100+
#[msgpack(map, allow_unknown_fields)]
101101
pub struct StoredFunction {
102102
pub tenant_id: u64,
103103
pub name: String,

nodedb/src/control/security/catalog/l2_cleanup_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use super::types::{L2_CLEANUP_QUEUE, SystemCatalog, catalog_err};
2121

2222
/// One queue entry: "L2 delete for this collection is still owed".
2323
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
24-
#[msgpack(map)]
24+
#[msgpack(map, allow_unknown_fields)]
2525
pub struct StoredL2CleanupEntry {
2626
pub tenant_id: u64,
2727
pub name: String,

nodedb/src/control/security/catalog/lockout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) use super::types::LOCKOUT_STATE as LOCKOUT_STATE_TABLE;
2020
/// in diagnostic queries. A `None` means no IP was available (e.g. in-process
2121
/// auth paths).
2222
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
23-
#[msgpack(map)]
23+
#[msgpack(map, allow_unknown_fields)]
2424
pub struct StoredLockoutRecord {
2525
/// Number of consecutive failed login attempts since the last success.
2626
pub failed_count: u32,

nodedb/src/control/security/catalog/materialized_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use nodedb_types::Hlc;
66

77
/// A materialized view: strict → columnar CDC bridge.
88
#[derive(zerompk::ToMessagePack, zerompk::FromMessagePack, Debug, Clone)]
9-
#[msgpack(map)]
9+
#[msgpack(map, allow_unknown_fields)]
1010
pub struct StoredMaterializedView {
1111
pub tenant_id: u64,
1212
pub name: String,

nodedb/src/control/security/catalog/oidc_providers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use super::types::{SystemCatalog, catalog_err};
1919
serde::Serialize,
2020
serde::Deserialize,
2121
)]
22-
#[msgpack(map)]
22+
#[msgpack(map, allow_unknown_fields)]
2323
pub struct StoredClaimMappingRule {
2424
/// Name of the JWT claim to inspect (e.g. `"org_id"`, `"groups"`).
2525
pub claim_name: String,
@@ -45,7 +45,7 @@ pub struct StoredClaimMappingRule {
4545
serde::Serialize,
4646
serde::Deserialize,
4747
)]
48-
#[msgpack(map)]
48+
#[msgpack(map, allow_unknown_fields)]
4949
pub struct StoredOidcProvider {
5050
/// Human-readable name; also the catalog key.
5151
pub provider_name: String,

0 commit comments

Comments
 (0)