@@ -9,7 +9,6 @@ use common::{
9
9
CanonicalizedComponentFunctionPath ,
10
10
CanonicalizedComponentModulePath ,
11
11
ComponentDefinitionId ,
12
- COMPONENTS_ENABLED ,
13
12
} ,
14
13
document:: {
15
14
ParsedDocument ,
@@ -184,10 +183,6 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
184
183
& mut self ,
185
184
component : ComponentDefinitionId ,
186
185
) -> anyhow:: Result < Vec < ParsedDocument < ModuleMetadata > > > {
187
- // TODO(CX-6379): Remove this branch once we've made modules component-aware.
188
- if !* COMPONENTS_ENABLED {
189
- anyhow:: ensure!( component. is_root( ) ) ;
190
- }
191
186
let index_query = Query :: full_table_scan ( MODULES_TABLE . clone ( ) , Order :: Asc ) ;
192
187
let mut query_stream = ResolvedQuery :: new ( self . tx , component. into ( ) , index_query) ?;
193
188
@@ -256,7 +251,11 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
256
251
order : Order :: Asc ,
257
252
} ;
258
253
let module_query = Query :: index_range ( index_range) ;
259
- let mut query_stream = ResolvedQuery :: new ( self . tx , TableNamespace :: Global , module_query) ?;
254
+ let namespace = self
255
+ . tx
256
+ . table_mapping ( )
257
+ . tablet_namespace ( module_id. table ( ) . tablet_id ) ?;
258
+ let mut query_stream = ResolvedQuery :: new ( self . tx , namespace, module_query) ?;
260
259
let module_version: ParsedDocument < ModuleVersionMetadata > = query_stream
261
260
. expect_at_most_one ( self . tx )
262
261
. await ?
@@ -269,7 +268,7 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
269
268
Ok ( module_version)
270
269
}
271
270
272
- pub async fn get_source (
271
+ pub async fn get_source_from_db (
273
272
& mut self ,
274
273
module_id : ResolvedDocumentId ,
275
274
version : ModuleVersion ,
@@ -299,12 +298,7 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
299
298
) -> anyhow:: Result < Option < ParsedDocument < ModuleMetadata > > > {
300
299
let timer = get_module_metadata_timer ( ) ;
301
300
302
- // TODO(CX-6379): Remove this branch once we've made modules component-aware.
303
- let is_system = if !* COMPONENTS_ENABLED {
304
- path. as_root_module_path ( ) ?. is_system ( )
305
- } else {
306
- path. module_path . is_system ( )
307
- } ;
301
+ let is_system = path. module_path . is_system ( ) ;
308
302
if is_system && !( self . tx . identity ( ) . is_admin ( ) || self . tx . identity ( ) . is_system ( ) ) {
309
303
anyhow:: bail!( unauthorized_error( "get_module" ) )
310
304
}
@@ -435,14 +429,8 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
435
429
& mut self ,
436
430
path : CanonicalizedComponentModulePath ,
437
431
) -> anyhow:: Result < Option < ParsedDocument < ModuleMetadata > > > {
438
- // TODO(CX-6379): Remove this branch once we've made modules component-aware.
439
- let module_path = if !* COMPONENTS_ENABLED {
440
- path. as_root_module_path ( ) ?
441
- } else {
442
- & path. module_path
443
- } ;
444
432
let namespace = path. component . into ( ) ;
445
- let module_path = ConvexValue :: try_from ( module_path. as_str ( ) ) ?;
433
+ let module_path = ConvexValue :: try_from ( path . module_path . as_str ( ) ) ?;
446
434
let index_range = IndexRange {
447
435
index_name : MODULE_INDEX_BY_PATH . clone ( ) ,
448
436
range : vec ! [ IndexRangeExpression :: Eq (
@@ -468,12 +456,7 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
468
456
& mut self ,
469
457
path : & CanonicalizedComponentFunctionPath ,
470
458
) -> anyhow:: Result < anyhow:: Result < AnalyzedFunction > > {
471
- // TODO(CX-6379): Remove this branch once we've made modules component-aware.
472
- let udf_path = if !* COMPONENTS_ENABLED {
473
- path. as_root_udf_path ( ) ?
474
- } else {
475
- & path. udf_path
476
- } ;
459
+ let udf_path = & path. udf_path ;
477
460
let Some ( module) = self . get_metadata_for_function ( path. clone ( ) ) . await ? else {
478
461
let err = ModuleNotFoundError :: new ( udf_path. module ( ) . as_str ( ) ) ;
479
462
return Ok ( Err ( ErrorMetadata :: bad_request (
0 commit comments