fix(jump-hop): preserve themed runtime metadata

This commit is contained in:
kdletters
2026-06-05 23:40:12 +08:00
parent cd8088d1fd
commit 36969726b4
3 changed files with 108 additions and 1 deletions

View File

@@ -283,7 +283,10 @@ pub async fn start_jump_hop_run(
) -> Result<Json<Value>, Response> {
let Json(payload) = jump_hop_json(payload, &request_context, JUMP_HOP_RUNTIME_PROVIDER)?;
ensure_non_empty(&request_context, &payload.profile_id, "profileId")?;
let is_draft_runtime = payload.runtime_mode.as_deref() == Some("draft");
let is_draft_runtime = payload
.runtime_mode
.as_deref()
.is_some_and(is_jump_hop_draft_runtime_mode);
let owner_user_id = principal.subject().to_string();
let principal_kind = principal.kind().as_str();
let run = state
@@ -1240,6 +1243,10 @@ fn build_jump_hop_work_play_tracking_draft(
WorkPlayTrackingDraft::runtime_principal("jump-hop", work_id, principal, source_route)
}
fn is_jump_hop_draft_runtime_mode(runtime_mode: &str) -> bool {
runtime_mode.trim().eq_ignore_ascii_case("draft")
}
fn build_jump_hop_draft(payload: &JumpHopWorkspaceCreateRequest) -> JumpHopDraftResponse {
let theme_text = normalize_theme_text(&payload.theme_text, &payload.work_title);
JumpHopDraftResponse {
@@ -1422,6 +1429,14 @@ fn current_utc_micros() -> i64 {
mod tests {
use super::*;
#[test]
fn jump_hop_draft_runtime_mode_detection_matches_client_normalization() {
assert!(is_jump_hop_draft_runtime_mode("draft"));
assert!(is_jump_hop_draft_runtime_mode(" DRAFT "));
assert!(!is_jump_hop_draft_runtime_mode("published"));
assert!(!is_jump_hop_draft_runtime_mode(""));
}
#[test]
fn jump_hop_tile_atlas_prompt_uses_dedicated_five_by_five_floor_layout() {
let prompt = build_jump_hop_tile_atlas_prompt("森林冒险", "森林主题清爽游戏化立体感平台");