f796b7d1e4
Production regression in 3.9.0: Telegram bot silently dropped every update. WizardDraftRepository.GetActiveAsync was called on every Telegram update (via UpdateRouter -> TryGetWizardContext) and threw System.PlatformNotSupportedException in NativeAOT, because Dapper.AOT 1.0.48 only generates interceptors for the (sql, object?) extension overloads and NOT for the (CommandDefinition) overload. The runtime then fell back to Dapper.SqlMapper.CreateParamInfoGenerator, which uses Reflection.Emit and fails on AOT. TelegramBotService swallowed the exception, so /newsession appeared to start but no button press reached the wizard and no session was created. Two related changes in WizardDraft: 1. Switched WizardDraftRepository.* from 'new CommandDefinition(sql, params, cancellationToken: ct)' to the direct 'connection.Query*(sql, params)' overload, matching the working pattern in JoinSessionHandler. Dapper.AOT now generates CommandFactory30<WizardDraft> + RowFactory17<WizardDraft> + QuerySingleOrDefaultAsync37<WizardDraft> for all four methods. 2. WizardDraft.CreatedAt/UpdatedAt/ExpiresAt are now DateTime (UTC) instead of DateTimeOffset. AOT RowFactory calls reader.GetDateTime() directly and does not perform DateTime -> DateTimeOffset conversion; the previous type raised InvalidCastException on the very first wizard_drafts query. All 588/590 tests pass (2 pre-existing skipped, +5 new AOT regression tests in WizardDraftRepositoryAotShapeTests). dotnet format clean. Bumps: 3.9.0 -> 3.9.1. Note: GetOwnerClubsAsync (Telegram/Discord), DiscordPermissionLookup, and DiscordWizardInteractionModule.GetOwnerClubsAsync still use CommandDefinition and will hit the same Reflection.Emit AOT failure when the user reaches the PickClub visibility step. Follow-up in 3.9.2.
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace GmRelay.Shared.Features.Sessions.CreateSession.Wizard;
|
|
|
|
public sealed class WizardDraft
|
|
{
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Stable string id of the chat/guild/channel this draft lives in.
|
|
/// Stored as <c>TEXT</c> to fit both Telegram's <c>long</c> chat ids
|
|
/// and Discord's snowflakes.
|
|
/// </summary>
|
|
public string ChatId { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Optional thread/topic id within the chat. Telegram's
|
|
/// <c>message_thread_id</c>, Discord's thread snowflake, <c>null</c>
|
|
/// when the chat has no sub-thread concept.
|
|
/// </summary>
|
|
public string? MessageThreadId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Platform-specific user id of the wizard owner. Telegram uses
|
|
/// <c>long</c>, Discord uses snowflakes — both fit in a string.
|
|
/// </summary>
|
|
public string OwnerId { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Which messenger platform owns this draft. Defaults to
|
|
/// <c>"Telegram"</c> for backward compatibility with pre-V032 rows.
|
|
/// </summary>
|
|
public string Platform { get; set; } = "Telegram";
|
|
|
|
public string Step { get; set; } = string.Empty;
|
|
|
|
public string PayloadJson { get; set; } = "{}";
|
|
|
|
/// <summary>
|
|
/// Id of the message that the wizard last edited. Stored as
|
|
/// <c>TEXT</c> to fit both Telegram's <c>int32</c> ids and Discord's
|
|
/// 64-bit snowflakes.
|
|
/// </summary>
|
|
public string? DraftMessageId { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
public DateTime UpdatedAt { get; set; }
|
|
|
|
public DateTime ExpiresAt { get; set; }
|
|
}
|