From 2d491d2219ffca2e57bb922661e2cbc4e22af265 Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Mon, 17 Jun 2024 18:05:14 +0100 Subject: [PATCH 1/3] chore: remove summary from retro reflection group --- ...18641323037_removeSummaryFromRetroGroup.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 packages/server/postgres/migrations/1718641323037_removeSummaryFromRetroGroup.ts diff --git a/packages/server/postgres/migrations/1718641323037_removeSummaryFromRetroGroup.ts b/packages/server/postgres/migrations/1718641323037_removeSummaryFromRetroGroup.ts new file mode 100644 index 00000000000..7d643fd260e --- /dev/null +++ b/packages/server/postgres/migrations/1718641323037_removeSummaryFromRetroGroup.ts @@ -0,0 +1,46 @@ +import {Kysely, PostgresDialect} from 'kysely' +import {r} from 'rethinkdb-ts' +import connectRethinkDB from '../../database/connectRethinkDB' +import getPg from '../getPg' + +export async function up() { + try { + await connectRethinkDB() + + await r + .table('RetroReflectionGroup') + .replace((row) => row.without('summary')) + .run() + + const pg = new Kysely({ + dialect: new PostgresDialect({ + pool: getPg() + }) + }) + + await pg.schema.alterTable('RetroReflectionGroup').dropColumn('summary').execute() + } catch (e) { + console.error('Error during migration:', e) + } +} + +export async function down() { + try { + await connectRethinkDB() + + await r.table('RetroReflectionGroup').update({summary: null}).run() + + const pg = new Kysely({ + dialect: new PostgresDialect({ + pool: getPg() + }) + }) + + await pg.schema + .alterTable('RetroReflectionGroup') + .addColumn('summary', 'varchar(2000)') + .execute() + } catch (e) { + console.error('Error during rollback:', e) + } +} From 539b751ea012ed2ea9017d87f948db9c040d814c Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Tue, 18 Jun 2024 09:56:44 +0100 Subject: [PATCH 2/3] remove old summary references --- .../helpers/notifications/SlackNotifier.ts | 4 ---- .../mutations/helpers/safeEndRetrospective.ts | 21 +------------------ .../resetRetroMeetingToGroupStage.ts | 2 +- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/packages/server/graphql/mutations/helpers/notifications/SlackNotifier.ts b/packages/server/graphql/mutations/helpers/notifications/SlackNotifier.ts index 7ebc7bdcf61..e6a21621883 100644 --- a/packages/server/graphql/mutations/helpers/notifications/SlackNotifier.ts +++ b/packages/server/graphql/mutations/helpers/notifications/SlackNotifier.ts @@ -658,10 +658,6 @@ export const SlackNotifier = { makeSection(`*Topic:*\n<${discussionUrl}|${topic}>`) ] - if (reflectionGroup.summary) { - slackBlocks.push(makeSection(`*Summary:*\n${reflectionGroup.summary}`)) - } - slackBlocks.push(makeSection(`*Reflections:* \n${reflectionsText}`)) const notificationChannel = { diff --git a/packages/server/graphql/mutations/helpers/safeEndRetrospective.ts b/packages/server/graphql/mutations/helpers/safeEndRetrospective.ts index b902b66c3a0..7be3917a108 100644 --- a/packages/server/graphql/mutations/helpers/safeEndRetrospective.ts +++ b/packages/server/graphql/mutations/helpers/safeEndRetrospective.ts @@ -15,7 +15,6 @@ import {analytics} from '../../../utils/analytics/analytics' import {getUserId} from '../../../utils/authorization' import getPhase from '../../../utils/getPhase' import publish from '../../../utils/publish' -import sendToSentry from '../../../utils/sendToSentry' import standardError from '../../../utils/standardError' import {InternalContext} from '../../graphql' import sendNewMeetingSummary from './endMeeting/sendNewMeetingSummary' @@ -35,7 +34,7 @@ const getTranscription = async (recallBotId?: string | null) => { } const summarizeRetroMeeting = async (meeting: MeetingRetrospective, context: InternalContext) => { - const {dataLoader, authToken} = context + const {dataLoader} = context const {id: meetingId, phases, facilitatorUserId, teamId, recallBotId} = meeting const r = await getRethink() const [reflectionGroups, reflections, sentimentScore] = await Promise.all([ @@ -48,24 +47,6 @@ const summarizeRetroMeeting = async (meeting: MeetingRetrospective, context: Int const discussionIds = stages.map((stage) => stage.discussionId) const reflectionGroupIds = reflectionGroups.map(({id}) => id) - const hasTopicSummary = reflectionGroups.some((group) => group.summary) - if (hasTopicSummary) { - const groupsWithMissingTopicSummaries = reflectionGroups.filter((group) => { - const reflectionsInGroup = reflections.filter( - (reflection) => reflection.reflectionGroupId === group.id - ) - return reflectionsInGroup.length > 1 && !group.summary - }) - if (groupsWithMissingTopicSummaries.length > 0) { - const missingGroupIds = groupsWithMissingTopicSummaries.map(({id}) => id).join(', ') - const error = new Error('Missing AI topic summary') - const viewerId = getUserId(authToken) - sendToSentry(error, { - userId: viewerId, - tags: {missingGroupIds, meetingId} - }) - } - } const [summary, transcription] = await Promise.all([ generateWholeMeetingSummary(discussionIds, meetingId, teamId, facilitatorUserId, dataLoader), getTranscription(recallBotId) diff --git a/packages/server/graphql/mutations/resetRetroMeetingToGroupStage.ts b/packages/server/graphql/mutations/resetRetroMeetingToGroupStage.ts index acb1a07e001..5e1238fedb9 100644 --- a/packages/server/graphql/mutations/resetRetroMeetingToGroupStage.ts +++ b/packages/server/graphql/mutations/resetRetroMeetingToGroupStage.ts @@ -112,7 +112,7 @@ const resetRetroMeetingToGroupStage = { r.table('Task').getAll(r.args(discussionIdsToDelete), {index: 'discussionId'}).delete().run(), pg .updateTable('RetroReflectionGroup') - .set({voterIds: [], summary: null, discussionPromptQuestion: null}) + .set({voterIds: [], discussionPromptQuestion: null}) .where('id', 'in', reflectionGroupIds) .execute(), r.table('NewMeeting').get(meetingId).update({phases: newPhases}).run(), From 5f4b817857b252ae86e5e12b2c5e4a75f14a4988 Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Tue, 18 Jun 2024 10:31:06 +0100 Subject: [PATCH 3/3] remove summary from reflectionGroup --- packages/server/database/types/ReflectionGroup.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/server/database/types/ReflectionGroup.ts b/packages/server/database/types/ReflectionGroup.ts index e4dd7bed7b0..e70419c0d31 100644 --- a/packages/server/database/types/ReflectionGroup.ts +++ b/packages/server/database/types/ReflectionGroup.ts @@ -10,7 +10,6 @@ export interface ReflectionGroupInput { voterIds?: string[] title?: string smartTitle?: string - summary?: string discussionPromptQuestion?: string } @@ -25,7 +24,6 @@ export default class ReflectionGroup { // userIds of the voters voterIds: string[] smartTitle: string | null - summary: string | null title: string | null discussionPromptQuestion: string | null constructor(input: ReflectionGroupInput) { @@ -38,7 +36,6 @@ export default class ReflectionGroup { updatedAt, voterIds, smartTitle, - summary, title, discussionPromptQuestion } = input @@ -52,7 +49,6 @@ export default class ReflectionGroup { this.updatedAt = updatedAt || now this.voterIds = voterIds || [] this.smartTitle = smartTitle || null - this.summary = summary || null this.title = title || null this.discussionPromptQuestion = discussionPromptQuestion || null }