debug(investigation): add logging to setGithubCommentId

Add console logging to track when githubCommentId is set in the store.
This helps diagnose race conditions and state synchronization issues.

Logs:
- Warning if called for non-existent investigation
- Confirmation when githubCommentId and postedAt are set

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This commit is contained in:
Sondre Engebråten
2026-02-16 09:18:12 +01:00
co-authored by Claude Sonnet 4.5
parent 4feea0891f
commit 0b6eaac577
@@ -324,9 +324,13 @@ export const useInvestigationStore = create<InvestigationStoreState>((set, get)
setGithubCommentId: (projectId: string, issueNumber: number, commentId: number) => set((state) => {
const key = `${projectId}:${issueNumber}`;
const existing = state.investigations[key];
if (!existing) return state;
if (!existing) {
console.warn(`[InvestigationStore] setGithubCommentId called for non-existent investigation ${key}`);
return state;
}
const now = new Date().toISOString();
const log = [...(existing.activityLog ?? []), { event: 'posted to GitHub', timestamp: now }].slice(-50);
console.log(`[InvestigationStore] Setting githubCommentId=${commentId} and postedAt=${now} for ${key}`);
return {
investigations: {
...state.investigations,