fix: settle puzzle failures and profile tasks

This commit is contained in:
kdletters
2026-05-26 22:02:58 +08:00
parent 4001ee0a5c
commit 17a184b0a7
14 changed files with 436 additions and 81 deletions

View File

@@ -52,7 +52,8 @@ pub use mapper::{
PuzzleAgentMessageSubmitRecordInput, PuzzleAgentSessionCreateRecordInput,
PuzzleAgentSessionRecord, PuzzleAgentSuggestedActionRecord, PuzzleAnchorItemRecord,
PuzzleAnchorPackRecord, PuzzleAudioAssetRecord, PuzzleBoardRecord, PuzzleCellPositionRecord,
PuzzleCreatorIntentRecord, PuzzleDraftLevelRecord, PuzzleFormDraftRecord,
PuzzleCreatorIntentRecord, PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord,
PuzzleFormDraftRecord,
PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord, PuzzleGeneratedImageCandidateRecord,
PuzzleGeneratedImagesSaveRecordInput, PuzzleLeaderboardEntryRecord,
PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord, PuzzlePieceStateRecord,

View File

@@ -99,7 +99,8 @@ pub use self::puzzle::{
PuzzleAgentMessageSubmitRecordInput, PuzzleAgentSessionCreateRecordInput,
PuzzleAgentSessionRecord, PuzzleAgentSuggestedActionRecord, PuzzleAnchorItemRecord,
PuzzleAnchorPackRecord, PuzzleAudioAssetRecord, PuzzleBoardRecord, PuzzleCellPositionRecord,
PuzzleCreatorIntentRecord, PuzzleDraftLevelRecord, PuzzleFormDraftRecord,
PuzzleCreatorIntentRecord, PuzzleDraftCompileFailureRecordInput, PuzzleDraftLevelRecord,
PuzzleFormDraftRecord,
PuzzleFormDraftSaveRecordInput, PuzzleGalleryCardRecord, PuzzleGeneratedImageCandidateRecord,
PuzzleGeneratedImagesSaveRecordInput, PuzzleLeaderboardEntryRecord,
PuzzleLeaderboardSubmitRecordInput, PuzzleMergedGroupRecord, PuzzlePieceStateRecord,

View File

@@ -636,6 +636,14 @@ pub struct PuzzleAgentMessageFinalizeRecordInput {
pub updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleDraftCompileFailureRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub error_message: String,
pub failed_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PuzzleGeneratedImagesSaveRecordInput {
pub session_id: String,

View File

@@ -1,7 +1,7 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
// This was generated using spacetimedb cli version 2.1.0 (commit 6981f48b4bc1a71c8dd9bdfe5a2c343f6370243d).
// This was generated using spacetimedb cli version 2.2.0 (commit eb11e2f5c41dce6979715ad407996270d61329f6).
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
@@ -468,6 +468,7 @@ pub mod list_visual_novel_runtime_history_procedure;
pub mod list_visual_novel_works_procedure;
pub mod list_wooden_fish_works_procedure;
pub mod mark_profile_recharge_order_paid_and_return_procedure;
pub mod mark_puzzle_draft_generation_failed_procedure;
pub mod match_3_d_agent_message_finalize_input_type;
pub mod match_3_d_agent_message_row_type;
pub mod match_3_d_agent_message_snapshot_type;
@@ -597,6 +598,7 @@ pub mod puzzle_audio_asset_type;
pub mod puzzle_board_snapshot_type;
pub mod puzzle_cell_position_type;
pub mod puzzle_creator_intent_type;
pub mod puzzle_draft_compile_failure_input_type;
pub mod puzzle_draft_compile_input_type;
pub mod puzzle_draft_level_type;
pub mod puzzle_event_kind_type;
@@ -1497,6 +1499,7 @@ pub use list_visual_novel_runtime_history_procedure::list_visual_novel_runtime_h
pub use list_visual_novel_works_procedure::list_visual_novel_works;
pub use list_wooden_fish_works_procedure::list_wooden_fish_works;
pub use mark_profile_recharge_order_paid_and_return_procedure::mark_profile_recharge_order_paid_and_return;
pub use mark_puzzle_draft_generation_failed_procedure::mark_puzzle_draft_generation_failed;
pub use match_3_d_agent_message_finalize_input_type::Match3DAgentMessageFinalizeInput;
pub use match_3_d_agent_message_row_type::Match3DAgentMessageRow;
pub use match_3_d_agent_message_snapshot_type::Match3DAgentMessageSnapshot;
@@ -1626,6 +1629,7 @@ pub use puzzle_audio_asset_type::PuzzleAudioAsset;
pub use puzzle_board_snapshot_type::PuzzleBoardSnapshot;
pub use puzzle_cell_position_type::PuzzleCellPosition;
pub use puzzle_creator_intent_type::PuzzleCreatorIntent;
pub use puzzle_draft_compile_failure_input_type::PuzzleDraftCompileFailureInput;
pub use puzzle_draft_compile_input_type::PuzzleDraftCompileInput;
pub use puzzle_draft_level_type::PuzzleDraftLevel;
pub use puzzle_event_kind_type::PuzzleEventKind;

View File

@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::puzzle_agent_session_procedure_result_type::PuzzleAgentSessionProcedureResult;
use super::puzzle_draft_compile_failure_input_type::PuzzleDraftCompileFailureInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct MarkPuzzleDraftGenerationFailedArgs {
pub input: PuzzleDraftCompileFailureInput,
}
impl __sdk::InModule for MarkPuzzleDraftGenerationFailedArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `mark_puzzle_draft_generation_failed`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait mark_puzzle_draft_generation_failed {
fn mark_puzzle_draft_generation_failed(&self, input: PuzzleDraftCompileFailureInput) {
self.mark_puzzle_draft_generation_failed_then(input, |_, _| {});
}
fn mark_puzzle_draft_generation_failed_then(
&self,
input: PuzzleDraftCompileFailureInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<PuzzleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl mark_puzzle_draft_generation_failed for super::RemoteProcedures {
fn mark_puzzle_draft_generation_failed_then(
&self,
input: PuzzleDraftCompileFailureInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<PuzzleAgentSessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, PuzzleAgentSessionProcedureResult>(
"mark_puzzle_draft_generation_failed",
MarkPuzzleDraftGenerationFailedArgs { input },
__callback,
);
}
}

View File

@@ -0,0 +1,18 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct PuzzleDraftCompileFailureInput {
pub session_id: String,
pub owner_user_id: String,
pub error_message: String,
pub failed_at_micros: i64,
}
impl __sdk::InModule for PuzzleDraftCompileFailureInput {
type Module = super::RemoteModule;
}

View File

@@ -167,6 +167,36 @@ impl SpacetimeClient {
.await
}
pub async fn mark_puzzle_draft_generation_failed(
&self,
input: PuzzleDraftCompileFailureRecordInput,
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
let procedure_input = PuzzleDraftCompileFailureInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
error_message: input.error_message,
failed_at_micros: input.failed_at_micros,
};
self.call_after_connect(
"mark_puzzle_draft_generation_failed",
move |connection, sender| {
connection
.procedures()
.mark_puzzle_draft_generation_failed_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_puzzle_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
},
)
.await
}
pub async fn save_puzzle_generated_images(
&self,
input: PuzzleGeneratedImagesSaveRecordInput,