fix(mcp-server): social-fast-coordinator-pipeline — stage_transition used non-existent currentStage field
FastingSessionDoc has stages: unknown[] not currentStage: string. - Replace currentStage cast with hasStages check (session.stages.length > 0) - Fix protocolId extraction to use direct field (session?.protocolId) - Report currentStage derived from stages.length as 'stage_N' indicator
This commit is contained in:
parent
64e1263fc0
commit
1da3394caf
@ -83,9 +83,10 @@ async function notifyMembers(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// If session has a current stage, fire stage_transition milestone push
|
// If session has stage entries (fast is progressing), fire stage_transition milestone push
|
||||||
const stage = (session as unknown as Record<string, unknown>)?.['currentStage'];
|
const hasStages =
|
||||||
if (stage && typeof stage === 'string') {
|
session !== null && Array.isArray(session.stages) && session.stages.length > 0;
|
||||||
|
if (hasStages) {
|
||||||
try {
|
try {
|
||||||
await nomgapPushFire({ type: 'stage_transition', userId }, opts);
|
await nomgapPushFire({ type: 'stage_transition', userId }, opts);
|
||||||
results.push({ userId, type: 'stage_transition', outcome: 'fired' });
|
results.push({ userId, type: 'stage_transition', outcome: 'fired' });
|
||||||
@ -128,9 +129,10 @@ async function sendWeeklyDigestAndReport(
|
|||||||
const fired = notifications.filter(n => n.outcome === 'fired').length;
|
const fired = notifications.filter(n => n.outcome === 'fired').length;
|
||||||
const failed = notifications.filter(n => n.outcome === 'failed').length;
|
const failed = notifications.filter(n => n.outcome === 'failed').length;
|
||||||
const stage =
|
const stage =
|
||||||
((session as unknown as Record<string, unknown>)?.['currentStage'] as string | null) ?? null;
|
session && Array.isArray(session.stages) && session.stages.length > 0
|
||||||
const protocolId =
|
? `stage_${session.stages.length}`
|
||||||
((session as unknown as Record<string, unknown>)?.['protocolId'] as string | null) ?? null;
|
: null;
|
||||||
|
const protocolId = session?.protocolId ?? null;
|
||||||
|
|
||||||
const summary =
|
const summary =
|
||||||
memberUserIds.length === 0
|
memberUserIds.length === 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user