Surface partial mirror fan-out failures as a warning, not a green success
When some mirror windows fail to sync during reprocess, return an error result so it renders as a warning banner (with the synced/failed counts and reasons) instead of a green success the admin might skim past while those windows are left stale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013UkZVYgLmquWV2xDn349T2
This commit is contained in:
parent
0baef5a948
commit
12c165a481
1 changed files with 7 additions and 3 deletions
|
|
@ -772,12 +772,16 @@ export async function action({ request, params }: Route.ActionArgs) {
|
||||||
if (event.isPrimary && event.tournamentId) {
|
if (event.isPrimary && event.tournamentId) {
|
||||||
try {
|
try {
|
||||||
const report = await syncMajorFromPrimaryEvent(event.id, { markComplete: false });
|
const report = await syncMajorFromPrimaryEvent(event.id, { markComplete: false });
|
||||||
let fanout = ` Synced ${report.windowsSynced} mirror window(s).`;
|
// Surface a partial fan-out as an error so it renders as a warning
|
||||||
|
// banner, not a green success the admin might skim past while some
|
||||||
|
// mirror windows are left stale.
|
||||||
if (report.windowsFailed > 0) {
|
if (report.windowsFailed > 0) {
|
||||||
const reasons = report.failures.map((f) => f.error).join("; ");
|
const reasons = report.failures.map((f) => f.error).join("; ");
|
||||||
fanout = ` Synced ${report.windowsSynced} mirror window(s); ${report.windowsFailed} failed: ${reasons}`;
|
return {
|
||||||
|
error: `${baseMessage} Synced ${report.windowsSynced} mirror window(s), but ${report.windowsFailed} failed (those windows may be stale): ${reasons}`,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return { success: `${baseMessage}${fanout}` };
|
return { success: `${baseMessage} Synced ${report.windowsSynced} mirror window(s).` };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return {
|
return {
|
||||||
error: `Primary window recomputed, but mirror fan-out failed (mirror windows may be stale): ${error instanceof Error ? error.message : String(error)}`,
|
error: `Primary window recomputed, but mirror fan-out failed (mirror windows may be stale): ${error instanceof Error ? error.message : String(error)}`,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue