fix(central-ui): Test Run banner says Notify is simulated; sandbox Send logs it (#151)

The Test Run banner in TemplateScriptDialog and SharedScriptForm claimed
External, Database and Notify all fire for real ("real emails"). Notify
is SandboxNotifyTarget, which returns a random GUID and sends nothing.
The banner now says External/Database are real and Notify is simulated,
pointing at Flow Debugger on a deployed instance for a real send. The
sandbox Send also writes a [sandbox] ... not delivered line to the
console pane. Notify.Status is unchanged (reports Unknown). Tests pin
the banner wording and the console line; Component-CentralUI.md notes
the simulated Notify.
This commit is contained in:
Joseph Doherty
2026-11-28 06:55:04 -05:00
parent 607ffc2e15
commit 8010fee2d2
6 changed files with 53 additions and 11 deletions
@@ -110,7 +110,8 @@
where it rendered as a third card band. *@
<div class="alert alert-warning py-1 mb-3 small">
<strong>Heads up:</strong>
<code>External</code>, <code>Database</code>, and <code>Notify</code> calls fire for real against central's configured systems — real HTTP, real SQL, real emails. Side effects are permanent.
<code>External</code> and <code>Database</code> calls fire for real against central's configured systems — real HTTP, real SQL. Side effects are permanent.
<code>Notify</code> is simulated: a fake <code>NotificationId</code> is returned and nothing is queued or sent — for a real send, run the script on a deployed instance from Deployment → Flow Debugger.
<code>CallShared</code> executes the named shared script (saved version) in the same sandbox.
<code>Attributes</code> and <code>CallScript</code> still throw.
</div>
@@ -164,7 +164,8 @@
<strong>Heads up:</strong>
runs the script as typed (unsaved edits included) against the supplied
<code>Parameters</code>.
<code>External</code>, <code>Database</code>, and <code>Notify</code> calls fire for real against central's configured systems — real HTTP, real SQL, real emails. Side effects are permanent.
<code>External</code> and <code>Database</code> calls fire for real against central's configured systems — real HTTP, real SQL. Side effects are permanent.
<code>Notify</code> is simulated: a fake <code>NotificationId</code> is returned and nothing is queued or sent — for a real send, run the script on a deployed instance from Deployment → Flow Debugger.
<code>CallShared</code> executes the named shared script (saved version) in the same sandbox.
<code>Instance</code>, <code>Attributes</code>, <code>Children</code>, <code>Parent</code>, and <code>CallScript</code> throw unless a bound instance is selected below — then they route to that live instance (attribute writes are permanent too).
</div>
@@ -129,7 +129,7 @@ public class SandboxNotifyHelper
/// <param name="listName">The notification list name.</param>
/// <returns>A <see cref="SandboxNotifyTarget"/> for the specified list.</returns>
public SandboxNotifyTarget To(string listName) =>
new();
new(listName);
/// <summary>
/// Queries the delivery status of a previously-sent notification. The
@@ -149,20 +149,31 @@ public class SandboxNotifyHelper
/// </summary>
public class SandboxNotifyTarget
{
private readonly string _listName;
/// <summary>Initializes a new instance of the SandboxNotifyTarget class.</summary>
internal SandboxNotifyTarget()
/// <param name="listName">The notification list name the script addressed.</param>
internal SandboxNotifyTarget(string listName)
{
_listName = listName;
}
/// <summary>
/// Mirrors <c>NotifyTarget.Send</c> — returns a <c>NotificationId</c>. In
/// the sandbox nothing is enqueued or delivered; a fake id is returned so
/// the call type-checks identically to production.
/// the call type-checks identically to production, and a
/// <c>[sandbox]</c> line is written to the Test Run console pane so the
/// operator is not left waiting for a message that will never arrive
/// (Gitea #151).
/// </summary>
/// <param name="subject">The notification subject.</param>
/// <param name="message">The notification message.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>A task that resolves to a fake notification ID string (a random GUID).</returns>
public Task<string> Send(string subject, string message, CancellationToken cancellationToken = default) =>
Task.FromResult(Guid.NewGuid().ToString("N"));
public Task<string> Send(string subject, string message, CancellationToken cancellationToken = default)
{
Console.Out.WriteLine(
$"[sandbox] Notify.To(\"{_listName}\").Send not delivered — Test Run does not send notifications");
return Task.FromResult(Guid.NewGuid().ToString("N"));
}
}