commit 8b066007fe786980863e1687763b42dc738f9c99
parent a62ed10ab334f9efb45e6d4dde0709f2435ce32a
Author: triesap <tyson@radroots.org>
Date: Wed, 24 Jun 2026 08:21:15 +0000
dto: guard indexed generated bindings
Diffstat:
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/packages/events-indexed-bindings/src/generated/types.ts b/packages/events-indexed-bindings/src/generated/types.ts
@@ -8,6 +8,6 @@ export type RadrootsEventsIndexedShardMetadata = { file: string, count: number,
export type RadrootsEventsIndexedManifest = { country: string, total: number, shard_size: number, first_published_at: number, last_published_at: number, shards: Array<RadrootsEventsIndexedShardMetadata>, };
-export type RadrootsEventsIndexedShardCheckpoint = { shard_id: RadrootsEventsIndexedShardId, last_created_at: number, last_event_id: string | null, cursor: string | null, };
+export type RadrootsEventsIndexedShardCheckpoint = { shard_id: RadrootsEventsIndexedShardId, last_created_at: number, last_event_id?: string | null, cursor?: string | null, };
export type RadrootsEventsIndexedIndexCheckpoint = { generated_at: number, shards: Array<RadrootsEventsIndexedShardCheckpoint>, };
diff --git a/tools/xtask/src/dto_roots.rs b/tools/xtask/src/dto_roots.rs
@@ -98,8 +98,8 @@ pub const SDK_LOCAL_WRAPPER_ALLOWANCES: &[SdkLocalWrapperAllowance] = &[
},
SdkLocalWrapperAllowance {
package_key: "events_indexed",
- shape_family: "index query result helpers",
- reason: "indexed package helpers represent SDK query projections rather than source-owned wire events",
+ shape_family: "RadrootsEventsIndexedShardId package alias",
+ reason: "source descriptors correctly describe the shard id newtype as a string, while package roots still need a stable named TypeScript alias",
},
];
@@ -247,6 +247,8 @@ mod tests {
const EVENTS_BINDINGS_TYPES_TS: &str =
include_str!("../../../packages/events-bindings/src/generated/types.ts");
+ const EVENTS_INDEXED_BINDINGS_TYPES_TS: &str =
+ include_str!("../../../packages/events-indexed-bindings/src/generated/types.ts");
const EVENTS_TYPE_INVENTORY: &[&str] = &[
"JobFeedbackStatus",
"JobInputType",
@@ -349,6 +351,14 @@ mod tests {
"RadrootsTradeQuestion",
"RadrootsTradeTransportLane",
];
+ const EVENTS_INDEXED_TYPE_INVENTORY: &[&str] = &[
+ "RadrootsEventsIndexedShardId",
+ "RadrootsEventsIndexedIdRange",
+ "RadrootsEventsIndexedShardMetadata",
+ "RadrootsEventsIndexedManifest",
+ "RadrootsEventsIndexedShardCheckpoint",
+ "RadrootsEventsIndexedIndexCheckpoint",
+ ];
#[test]
fn approved_source_roots_build_registries() {
@@ -394,16 +404,32 @@ mod tests {
.iter()
.any(|allowance| allowance.shape_family.contains("IResult"))
);
+ assert!(SDK_LOCAL_WRAPPER_ALLOWANCES.iter().any(|allowance| {
+ allowance
+ .shape_family
+ .contains("RadrootsEventsIndexedShardId")
+ }));
}
#[test]
fn events_type_inventory_matches_current_package_surface() {
- let actual = EVENTS_BINDINGS_TYPES_TS
+ let actual = type_inventory(EVENTS_BINDINGS_TYPES_TS);
+
+ assert_eq!(actual, EVENTS_TYPE_INVENTORY);
+ }
+
+ #[test]
+ fn events_indexed_type_inventory_matches_current_package_surface() {
+ let actual = type_inventory(EVENTS_INDEXED_BINDINGS_TYPES_TS);
+
+ assert_eq!(actual, EVENTS_INDEXED_TYPE_INVENTORY);
+ }
+
+ fn type_inventory(types_ts: &str) -> Vec<&str> {
+ types_ts
.lines()
.filter_map(|line| line.strip_prefix("export type "))
.map(|rest| rest.split([' ', '<']).next().expect("type name"))
- .collect::<Vec<_>>();
-
- assert_eq!(actual, EVENTS_TYPE_INVENTORY);
+ .collect()
}
}