@@ -58,8 +58,12 @@ struct DatasetDetail {
5858struct UpdateResponse {
5959 id : String ,
6060 label : String ,
61- #[ serde( default = "default_schema" ) ]
62- schema_name : String ,
61+ // Not currently in runtimedb's UpdateDatasetResponse; kept Optional so we
62+ // print `full_name` only when the server actually returns the schema.
63+ // Synthesizing "main" is wrong for sandbox-scoped datasets where
64+ // schema_name == sandbox_id.
65+ #[ serde( default ) ]
66+ schema_name : Option < String > ,
6367 table_name : String ,
6468 #[ serde( default ) ]
6569 latest_version : Option < i32 > ,
@@ -527,7 +531,23 @@ pub fn update(
527531 "table" => {
528532 println ! ( "id: {}" , d. id) ;
529533 println ! ( "label: {}" , d. label) ;
530- println ! ( "full_name: datasets.{}.{}" , d. schema_name, d. table_name) ;
534+ match & d. schema_name {
535+ Some ( schema) => {
536+ println ! ( "full_name: datasets.{}.{}" , schema, d. table_name) ;
537+ }
538+ None => {
539+ println ! ( "table_name: {}" , d. table_name) ;
540+ use crossterm:: style:: Stylize ;
541+ eprintln ! (
542+ "{}" ,
543+ format!(
544+ "(run `hotdata datasets {}` to see the qualified name)" ,
545+ d. id
546+ )
547+ . dark_grey( )
548+ ) ;
549+ }
550+ }
531551 println ! ( "updated_at: {}" , crate :: util:: format_date( & d. updated_at) ) ;
532552 }
533553 _ => unreachable ! ( ) ,
@@ -555,11 +575,28 @@ mod tests {
555575 assert_eq ! ( resp. id, "ds_abc123" ) ;
556576 assert_eq ! ( resp. label, "url_test" ) ;
557577 assert_eq ! ( resp. table_name, "url_test" ) ;
558- assert_eq ! ( resp. schema_name, "main" ) ; // defaulted
578+ // The server doesn't currently send schema_name, so we don't synthesize
579+ // one — sandbox-scoped datasets live under datasets.<sandbox_id>.<table>,
580+ // not datasets.main.*, and a fabricated "main" would mislead users.
581+ assert ! ( resp. schema_name. is_none( ) ) ;
559582 assert_eq ! ( resp. latest_version, Some ( 3 ) ) ;
560583 assert ! ( resp. pinned_version. is_none( ) ) ;
561584 }
562585
586+ #[ test]
587+ fn update_response_uses_schema_name_when_server_supplies_it ( ) {
588+ // Forward-compat: if runtimedb later includes schema_name, we use it.
589+ let body = serde_json:: json!( {
590+ "id" : "ds_abc123" ,
591+ "label" : "x" ,
592+ "schema_name" : "sandbox_xyz" ,
593+ "table_name" : "x" ,
594+ "updated_at" : "2026-04-28T18:30:00Z" ,
595+ } ) ;
596+ let resp: UpdateResponse = serde_json:: from_value ( body) . unwrap ( ) ;
597+ assert_eq ! ( resp. schema_name. as_deref( ) , Some ( "sandbox_xyz" ) ) ;
598+ }
599+
563600 #[ test]
564601 fn update_response_handles_pinned_version ( ) {
565602 let body = serde_json:: json!( {
0 commit comments